#TREEDEGREE. Degree of a Tree
Degree of a Tree
mrm_196 always represents the rooted trees in a simple array, but the array holds four conditions:
- If the tree has N vertices, the array has length 2N.
- Each vertex has a number (from 1 to N) which is written twice (but they may not be necessarily beside each other).
- Between the numbers of each vertex, the numbers on its subtree are written.
- Vertex 1 is always the root of the tree.
For example, he may store the following tree in one of these six ways:
Tree = {1, 3, 2, 2, 4, 4, 5, 5, 3, 1}
Tree = {1, 3, 4, 4, 2, 2, 5, 5, 3, 1}
Tree = {1, 3, 5, 5, 4, 4, 2, 2, 3, 1}
Tree = {1, 3, 2, 2, 5, 5, 4, 4, 3, 1}
Tree = {1, 3, 4, 4, 5, 5, 2, 2, 3, 1}
Tree = {1, 3, 5, 5, 2, 2, 4, 4, 3, 1}
Your task is pretty simple, find what he always wanted, THE DEGREE OF THE TREE!!!!
Degree of a tree is the maximum degree of all its vertices.
Input
The first line of the input contains an integer T (1 ≤ T ≤ 20) — the number tests to answer.
The first line of each test contains an integer N (1 ≤ N ≤ 100 000) — the number of vertices in the tree.
The second line of each test contains 2N integers a1, a2, ..., a2N (1 ≤ ai ≤ N) — the elements of his array.
It’s guaranteed that the given array always forms at least one valid tree.
Output
For each test, print a single integer in one line — the degree of the tree.
Example
Input: 2 1 1 1 5 1 3 2 2 4 4 5 5 3 1</p>Output: 0 4
Warning: large Input/Output data, be careful with certain languages