A tree with N vertices is given (2≤N≤100,000). The vertices are numbered 1 to N, and vertex 1 is the root.
You are given M pairs of nodes (1≤M≤100,000). For each pair, print the number of the lowest common ancestor of the two nodes. Among all common ancestors of the two nodes, the lowest common ancestor is the one farthest from the root.
A vertex is an ancestor of itself. So if one vertex of a pair is an ancestor of the other, the answer is that ancestor.