Problem: You are given a tree consisting of vertices. There is an integer written on each vertex; the -th vertex has integer written on it.
You have to process queries. The -th query consists of three integers , and . For this query, you have to answer if it is possible to choose a set of vertices (possibly empty) such that:
- every vertex is on the simple path between and (endpoints can be used as well);
- , where denotes the bitwise XOR operator.
Input Format: The first line contains one integer ().
The second line contains integers ().
Then lines follow. Each of them contains two integers and (; ) denoting an edge of the tree.
The next line contains one integer () — the number of queries.
Then lines follow. The -th of them contains three integers , and (; ).
Output Format: For each query, print YES if it is possible to form a set of vertices meeting the constraints. Otherwise, print NO.
You can print each letter in any case.