No legend
You are given a tree that has vertices, with a root of .
We assume that the immediate parent of the vertex is for .
There are two types of queries to be executed:
You are given three integers and . You should replace with for all with .
You are given two integers . You must find the LCA of the vertices and (their lowest common ancestor).
Input
The first line contains two integers and — the number of vertices and the number of queries, respectively.
The second line contains integers , where is the parent of the node .
The following rows contain queries. For each query, the first integer of the string is or query type.
If , then this is a request of the first type. Then three integers will follow: , which means that you need to replace with for all with .
If , then this is a request of the second type. Then two integers will follow: and , and you should find LCA and .
It is guaranteed that there is at least one request of the second type.
Output
For each request of the second type, print the answer in a new line.