Output the lowest common ancestor.
The first line contains a positive integer t, which indicates how many cases in the input. For each case, the first line contains a positive integer N (1 <= N <= 100000), denoting the amount of node in the tree (labeled from 1 to N). The second line contains exactly N numbers. The first number denotes the parent of node 1, and the second number denotes the parent of node 2 ..., etc. The parent of the root will be labeled as -1.
Then multiple queries (query < 100) follow. Each line contains two positive integers A and B. The query is terminated by two zeros.
Each case is separated by a blank line.
For each case a line, print the case number first, then output the node number of the least common ancestor for each query. Each answer should be separated by a single space.