F. Hate-matrix Potter
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Ammar got enough and can't take those matrices stuff anymore. So he decided to go visit his wizard friend and tell him to remove the matrices from the world. So he travelled to hate-matrix land where his friend lives.

Hate-matrix land is a rooted tree of $$$n$$$ nodes; there are some rules in hate-matrix land:

  • The parent of node $$$x$$$ is the unique node that is directly connected to $$$x$$$ by an edge and is closer to the root than $$$x$$$.
  • Nodes $$$x$$$ and $$$y$$$ are siblings if they have the same parent.
  • If a person currently is in node $$$x$$$, he can go to node $$$y$$$ if and only if $$$y$$$ is the parent of $$$x$$$ or $$$x$$$ and $$$y$$$ are siblings.

In the tree in the photo, $$$1$$$ is the parent of $$$2$$$ , and $$$2$$$ and $$$4$$$ are siblings. If you start in node $$$3$$$, you can go to node $$$2$$$ because it is its parent, and then you can go to node $$$4$$$ because $$$2$$$ and $$$4$$$ are siblings. So node $$$4$$$ is reachable by $$$3$$$, but $$$5$$$ isn't.

Ammar knows that the tree is rooted at node $$$root$$$; he currently is in node $$$x$$$, and his friend is in node $$$y$$$. They want to meet in either $$$x$$$ (his friend must be able to reach it) or in node $$$y$$$(he has to be able to reach it). Can you help Ammar find out whether they could meet and remove matrices forever? You have to answer $$$q$$$ queries.

Input

The first line contains two integers $$$n,q \: (2 \leq n \leq 2 \cdot 10^5)(1 \leq q \leq 2 \cdot 10^5)$$$ —the number of nodes and the number of queries.

Each of the next $$$n-1$$$ lines consists of two integers $$$u,v \: (1 \leq u,v \leq n)$$$ — the description of the edges of the tree. It's guaranteed that the given edges form a valid tree.

Each of the next $$$q$$$ lines consists of three integers $$$root,x,y \: (1 \leq root,x,y \leq n)$$$ — the description of each query.

Output

For each query, print "YES" if they could meet and "NO" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Example
Input
5 5
1 2
2 3
1 4
4 5
1 2 4
1 3 5
4 5 3
2 2 3
3 1 5
Output
YES
NO
YES
YES
YES