Given a tree with $n$ vertices labeled $1, \dots, n$, and a sequence $a_1, \dots, a_{n_0}$ of length $n_0$, there are $m$ queries. Each query provides $l, r, x$, and asks for the vertex reached starting from vertex $x$ by moving one step towards each of $a_l, \dots, a_r$ in sequence.
If $x = y$, moving one step from $x$ towards $y$ results in $x$. Otherwise, it results in the vertex adjacent to $x$ that is closest to $y$ in the tree.
Input
The first line contains three integers $n, n_0, m$.
The next line contains $n-1$ integers representing $f_2, \dots, f_n$, where $f_i$ is the parent of vertex $i$, and $1$ is the root.
The next line contains $n_0$ integers representing $a_1, \dots, a_{n_0}$.
The next $m$ lines each contain three integers $l, r, x$ representing a query.
Output
Output $m$ lines, each containing the answer for the corresponding query.
Examples
Input 1
5 4 3
1 1 3 3
5 2 2 3
3 4 5
1 3 4
1 2 1
Output 1
3
2
1
Subtasks
Idea: Ynoi, Solution: zhoukangyang & ccz181078, Code: zhoukangyang, Data: ccz181078
For $100\%$ of the data, $1 \le n, n_0, m \le 10^6$.