You are given an unweighted tree that contains only 1 node. You have to process the following two types of queries:
For each query of type 2, you must print the required answer. Note that the length of the path is equal to the number of edges in the path.
Input format
Output format
For each query of type 2, you are required to print the length of the largest simple path starting at node x.
In the first test case of the given sample:
First, we connect a new node with the node 1 of the tree. The new node will have number 2.
Then we connect a new node with the node 2 of the tree. The new node will have number 3.
Now length of the largest path starting with node 1 is 2. The path is 1 -> 2 -> 3
Now we connect a new node with the node 2 of the tree. The new node will have number 4.
Now we connect a new node with the node 4 of the tree. The new node will have number 5.
Now length of the largest path starting with node 3 is 3. The path is 3 -> 2 -> 4 -> 5.