LCA offline (Easy)#2317

LCA offline (Easy)

1 secondo
128 megabyte
Facile

Initially, there is a tree consisting only of the root (the vertex with number ). You must answer the following queries:

Vertices are numbered from to . There is always exactly one tree.

Input

The first line contains the integer — the number of queries. The next lines contain the queries. It is guaranteed that the number of queries of each type does not exceed .

Output

For each query of type GET, print a single integer — the answer to the corresponding query, on a separate line.

Esempi

Esempio 1

Loading
Loading