You are given a tree has n vertices, each vertice has a weight. Vertice i's weight is. . Henry has q queries, each query has two vertices u, v. He wants to know the xor sum of the weights of all vertices on the shortest path from u to v .
In graph theory, if an undirected gragh G(V, E) without cycle has n vertices, n − 1 edges and the graph is connected, then G(V, E) is called a tree. You are given a tree has n vertices, each vertice has a weight. Vertice i's weight is w_i w i . Henry has q queries, each query has two vertices u, v. He wants to know the xor sum of the weights of all vertices on the shortest path from u to v (contains u,v).
(图片来源网络,侵删)