The first line contains N and Q. (1≤N,Q≤105)
The second line contains N−1 integers A2,A3,…,AN. Ai means that the parent of timeline i in the tree is timeline Ai. (1≤Ai≤N, Ai=i) The given edges always form a single tree. When N=1, the second line is empty.
Each of the next Q lines contains one query in the form c v. If c=1 it is a query of type 1, and if c=2 it is a query of type 2. (1≤v≤N) A query of type 1 is never given twice for the same timeline.