You are playing a game in which you must defend your village from a dragon.
The village can be represented as a tree (a connected acyclic graph) with nodes, indexed form to , each node representing fortifications of varying heights. The height of fortification is denoted as .
The dragon has a power level of and starts flying at the base of fortification (i. e. its initial height is ). Its goal is to attack fortification . It flies along the path from to and when it encounters a fortification with a height greater than or equal to its current height, it loses points from its power and continues flying at a height of .
Unfortunately, there's a bug in the game: if the dragon's current power becomes less than , it immediately becomes . You have the ability to shuffle the fortifications along the path from to . Your objective is to find an arrangement such that the dragon's power is reduced to when it reaches fortification , preventing the dragon from attacking it.
Being given scenarios , you should find if it's possible to shuffle the fortifications along the path from from so the dragon won't attack the tower .
Input
The first line contains one integer (, the number of nodes. The second line contains integers , , , .
Each of the following lines contains two integers and , meaning that there is an edge between and .
The next line contains one integer (, the number of scenarios. Each of the next lines contains three integers , and describing a scenario.
Output
For each scenario, output "YES" if it's possible to shuffle the fortifications so the dragon won't attack, or "NO" otherwise.
Example
stdin
9
1 2 3 4 5 6 7 8 9
1 2
1 3
1 4
2 5
3 6
3 7
4 8
6 9
3
5 7 13
5 7 1
9 8 12
stdout
YES
NO
YES