K. Water Filling
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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:

  • water fills tank $$$v$$$ with one liter;
  • if there's more water left, then while there are unfilled child tanks, water flows in the direction of the smallest (i.e., by index) tank and repeats the same process;
  • if there's more water left, it goes up and starts filling the parent tank with the same process.

Here are some examples of the process described above:

filling tank 5 with 2 litersfilling 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?

Input

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$$$.

Output

For each query, output "YES" if the tank will be filled, and output "NO" otherwise.

Example
Input
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
Output
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
YES