The first line contains the number of vertices N and the number of queries Q. (1≤N≤300000, 1≤Q≤300000)
The second line contains N−1 integers p2,p3,…,pN. Here pk is the parent of vertex k and satisfies 1≤pk<k. When N is 1, the second line is empty.
Each of the next Q lines contains one query. The first integer on a line is the query type, followed by the integers that type takes.