The input consists of several scenarios. Each scenario consists of a single line. This line contains an expression that describes the sequence of king's decrees, and hence also the current state of the roads in Failland. The expression is one of the following:
- V stands for a single town controlled by a single division.
- U e1 e2, where e1 and e2 are expressions. The expressions e1 and e2 correspond to disjoint sets of towns, each of the sets is under control of a different division of road-workers. The expression U e1 e2 describes the situation after the king ordered these divisions to unite, i.e., the new united division now controls all the towns in e1 and e2, and maintains still the same set of roads (the union of the roads maintained before, as described by e1 and e2).
- C e, where e is an expression. This expression describes the situation after the division described by e received the order to take care of the roads they neglected so far. The division still controls the same set of towns, but now maintains exactly those roads they did not maintain before the order was received. Of course, only the roads connecting two towns both controlled by the same division are concerned. The roads they used to maintain before are not maintained anymore and are considered destroyed immediately.
For example, "C U U V V V" describes the land with three towns controlled by a single union, and with all three roads between these towns in a perfect condition, forming a triangle. The expression "U C U U V V V C U U V V V" describes the land with six towns formed as a union of two such triangles. The expression "C U C U U V V V C U U V V V" describes the same land after the decree that orders road-workers to repair the neglected roads. Now the land has six towns and 9 roads -- all of the roads between all pairs of towns, except for those six that belonged to the triangles.
Each line of the input contains at most 200 000 characters.