Mirko and Slavko love playing with marbles. On an exciting Friday, Mirko has come up with a marble game which he wants to show to Slavko.
In the game, Mirko constructs a directional graph in which all vertices have at most one outgoing edge. Then he places a marble on one of the vertices. Whenever a marble is on some vertex
To make sure that Slavko understands the rules of the game, Mirko will ask a series of queries. The types of queries are as follows:
1 X
– unless the marble gets stuck in a loop, on which vertex will the marble stop if it is placed on the vertex
2 X
– delete the outgoing edge of the vertex
Note: queries are executed in order and are cumulative (one affects another).
Input Specification
The first line contains a positive integer
The second line contains exactly
The following line contains a single positive integer
The remaining
Output Specification
For each query of type CIKLUS
instead.
Sample Input 1
3
2 3 1
7
1 1
1 2
2 1
1 2
1 1
2 2
1 2
Sample Output 1
CIKLUS
CIKLUS
1
1
2
Sample Input 2
5
0 3 5 3 4
6
1 1
1 2
2 4
1 2
2 3
1 2
Sample Output 2
1
CIKLUS
4
3
Comments