You are given an undirected tree with nodes rooted at node 1. Every node has a value assigned to it. You are required to answer queries of the following type:
Find the required answer for queries.
Note:
Input format
Output format
For each test case, print space-separated integers denoting the longest length common prefix for queries. Print the output for each test case in a new line.
Constraints