You are given a tree with N vertices. The vertices are numbered from 1 to N, and vertex 1 is the root.
The lowest common ancestor of two vertices u and v is the vertex that is an ancestor of both and lies farthest from the root. A vertex counts as an ancestor of itself here.
You are given M pairs of vertices. For each pair, find the number of its lowest common ancestor.