There are $$$n$$$ water tanks, each one liter in size. Water tanks are connected by pipes, where a pipe connects tank $$$v$$$ to parent tank $$$p_v$$$. Tank $$$1$$$ is the root.
Let's define the process of filling water tank $$$v$$$ with $$$x$$$ liters as follows:
Here are some examples of the process described above:
![]() | ![]() |
| filling tank 5 with 2 liters | filling tank 6 with 4 liters |
Given $$$q$$$ queries of the form $$$(v, x, u)$$$, you should answer the following task:
If $$$x$$$ liters are added to tank $$$v$$$, will tank $$$u$$$ be filled as well?
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$q$$$ $$$(2 \le n, q \le 10^5)$$$ — the number of water tanks and queries respectively.
The second line of each test case contains $$$n - 1$$$ integers $$$p_2, \ldots, p_n$$$ $$$(1 \le p_i \le n)$$$ — the parent of tank $$$i$$$, i.e., there is a pipe between $$$i$$$ and $$$p_i$$$ in the tree.
Each of the next $$$q$$$ lines contains three integers $$$v_i, x_i, u_i$$$ $$$(1 \le v_i, x_i, u_i \leq n)$$$ — indicating the $$$i$$$-th query.
It is guaranteed that the given set of pipes forms a tree.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$ and the sum of $$$q$$$ over all test cases does not exceed $$$10^5$$$.
For each query, output "YES" if the tank will be filled, and output "NO" otherwise.
2 6 6 1 1 2 2 3 5 2 2 5 2 1 5 2 5 6 4 3 6 4 2 6 4 4 7 7 1 1 2 2 3 3 3 2 7 3 3 7 3 2 1 3 4 1 3 3 1 3 6 4 2 3 4
YES NO YES YES YES NO NO YES NO YES NO YES YES
| Name |
|---|


