
Billy is a hard-working student. He is fond of computers and wants to learn as much as possible about them. He is currently studying graph theory and must write a program to construct the graph shown in the figure above.
The vertices of the graph are labeled sequentially with integer keys from to N-1 (N \leq 10000). There are two types of edges: backward edges, labeled with in the figure (for example, from node to node , or from node to node ), and forward edges, labeled with (for example, from node to node , or from node to node ).
Billy's program initially works with a graph that contains the vertices , , , and . Then, it should build the graph according to a sequence of commands given in a text file. Each command has the following format:
where and are the numbers of the vertices, and is a sequence of operations to be performed from right to left. An operation is represented by one of the following characters:

Here, is the array of graph vertices. The argument of the first operation is the vertex . The result of the and operations is a vertex, which becomes the argument for all the remaining operations. The and operations must appear on the leftmost position. As an example, consider the following command:
index0 = 4, index1 = 0
x = f(v[0]) // forward to node 3, x = 3 y = f(x) // forward creates node (4), y = 4 k(y) // prints the key (4) V[4] = y // put node (4) in array v
A vertex is put into the array only by the operation. Initially, contains the vertices with keys , , , : v[0]=0, v[1]=1, v[2]=2, v[3]=3.
A text file containing the sequence of commands. Whitespace may appear freely in the input. The input data ends at the end of the file.
Each output must be written to the standard output at the beginning of a line. There are no empty lines between outputs.
An input/output sample is shown in the table below.

Example 1