You are given a tree with
a b x
XOR every other node on the path from to by . (update node , 3rd node on path to , 5th node on path to ).
After all the updates, output the value of each node.
Input Specification
The first line of input contains
The next line contains
The next
The next
Output Specification
Output one line containing
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
Sample Input
Copy
7 2
0 0 0 0 0 0 0
1 2
2 3
3 4
1 5
5 6
6 7
4 7 2
3 6 3
Sample Output
Copy
3 2 3 2 2 3 2
Comments