Given a tree with $$$n$$$ nodes, you can use several line segments of arbitrary lengths to cover all the edges of the tree, with the following requirements:
You can choose any number of line segments such that these segments can cover the entire tree according to the above requirements, but you need to minimize the maximum length of the segments. Your task is to find this minimum value.
The first line contains an integer $$$T$$$ $$$(1 \le T \le 10^5)$$$, representing the number of test cases.
For each test case, the first line contains an integer $$$n$$$ $$$(2 \le n \le 2\cdot 10^5)$$$, representing the total number of nodes in the tree.
The second line contains $$$n-1$$$ integers $$$p_2, p_3, \ldots , p_n$$$ $$$(1 \le p_i \lt i)$$$, where $$$p_i$$$ represents the index of the parent node of node $$$i$$$.
It is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output a single integer on a new line, representing the minimum possible maximum length of the line segments.
281 2 3 2 5 1 781 2 3 4 5 6 7
3 7
For the first sample test case, the illustration is as follows. The red, green, and blue segments represent three line segments with lengths of 2, 3, and 2, respectively.
| Название |
|---|


