A tree is a connected graph without cycles. You are given a rooted tree with nn nodes, labeled from 1 to n1ton. The tree is rooted at node 11. The parent of the ii-th node is f_{a_i}fai. The edge weight between the ii-th node and f_{a_i}fai is w_iwi
- E(u, v)E(u,v) is a set of all the nodes through a path which is from uu to vv, including uu and vv. For example,
E(5,3) = \{5, 2, 1, 3\}, E(4,6) = \{4, 3, 6\}, E(2,5) = \{2,5\}E(5,3)={5,2,1,3},E(4,6)={4,3,6},E(2,5)={2,5}
- X(u, v)X(u,v) represents the XOR of all edge weights on the path from uu to vv
For example, in the case given above,
X(1,5) = 1X(1,5)=1 xorxor 1=01=0,X(4,6) = 1X(4,6)=1 xorxor 3=23=2,X(2,5