You are given a weighted tree (an acyclic undirected connected graph) with nodes. The tree nodes are numbered from 1 to . There are edges with each having a weight assigned to it.
You have to process queries on it. In each query, you are given three integers . You are required to determine the maximum XOR that you can obtain when you the bitwise XOR operation on any edge weight in the path from node to node with .
For example
You are given the following tree:
You get a query . Therefore, in this case, your task is to determine the maximum XOR that you can obtain when you XOR with any edges in the path from node 9 to node 7.
The path from node 9 to node 7 is marked red for better understanding.
There are 5 edges in the path from node 9 to node 7 and there weight are as follows: . If you XOR 12 with , that is, 12^1 = 13 and this the maximum XOR that you can obtain. Therefore, the answer to this query is 13.
Input format
Output Format
For each query, print a single integer in a new line.
Constraints
2 N, Q 105
1 u, v N and (u!=v)
1 w, x 106