Given a rooted tree and two vertices on it, the nearest common ancestor (NCA) of the two vertices is defined as follows.

For example, in the figure above, both vertex 4 and vertex 8 have 15 and 11 as descendants, but the deepest such vertex (the one closest to 15 and 11) is 4, so the nearest common ancestor is 4.
Given a rooted tree and two vertices, write a program that finds the nearest common ancestor of the two vertices.
The first line contains the number of test cases T.
Each test case is given as follows.
For each test case, print the nearest common ancestor of the two given vertices on its own line.