You are given a tree of $$$n$$$ nodes (the nodes are indexed from $$$1$$$ to $$$n$$$) that is rooted at node $$$1$$$.
Each node has a distinct value $$$a_i$$$ written on it. Let us define $$$Sub(u)$$$ to be the set of all nodes that are in the subtree of node $$$u$$$ (node $$$u$$$ is also included in its subtree).
You have to process $$$Q$$$ queries of $$$4$$$ different types. They are as follows:
It is guaranteed that, at any time, there are no two distinct nodes in the tree that have the same value.
Note: The $$$mex$$$ of a collection of integers $$$c_1, c_2, \ldots, c_k$$$ is defined as the smallest non-negative integer $$$x$$$ which does not occur in the collection $$$c$$$.
The first line contains two space separated integers denoting $$$n,q (2 \le n,q \le 2 \cdot 10^5)$$$.
The next line contains $$$n-1$$$ space separated integers $$$p_2, p_3, \dots, p_n(1 \le p_i \le n)$$$ where $$$p_i$$$ denotes an edge between node $$$p_i$$$ and $$$i$$$ where $$$p_i$$$ is the parent of $$$i$$$.
The next line contains $$$n$$$ space separated integers $$$a_1, a_2, \dots, a_n(0 \le a_i \le 10^9)$$$.
The next $$$q$$$ lines contain the queries as described above.
It's guaranteed:
For each query of type $$$4$$$, print the answer in a new line.
5 51 2 3 35 4 3 2 11 5 7 04 52 33 2 04 2
2 1
