The first line of the input contains two integers![]()
.
The second line containsintegers
--- the parents of vertices from the second to the
-th
.
The nextlines each line contains two integers, and the
-th line belongs to one of the three types mentioned above.
It is guaranteed that there hasquery task.
For each query task, you should output one line containing an integer.