Initially, there is a tree consisting only of the root (the vertex with number ). You must answer the following queries:
ADD — connect vertex to vertex (it is guaranteed that vertex already exists).
GET — return the LCA (Lowest Common Ancestor) of vertices and .
Vertices are numbered from to . There is always exactly one tree.
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 .
For each query of type GET, print a single integer — the answer to the corresponding query, on a separate line.

Example 1