Lca - Lowest Common Ancestor

medium
<a href="https://www.spoj.com/problems/LCA/">https://www.spoj.com/problems/LCA/</a>

Input Format

.

Output Format

.

Constraints

.

Notice

.

Example

Input
1
7
3 2 3 4
0
3 5 6 7
0
0
0
0
2
5 7
2 7
Output
Case 1:
3
1
Previous
K'th Ancestor
Next
Cats And Tree

Related Questions