A national park has outposts joined by trails. Every outpost can be reached from every other one, and between any two of them there is exactly one route - the trails form a tree.
The rangers want to know the worst case. Somewhere in the park there is a pair of outposts whose route is longer than any other, and they want to know how many trails that route uses. That number is the diameter of the tree.
Write a program that finds it.
Input
First line of input will be a single integer - the number of testcases.
The first line of each testcase contains a single integer - the number of outposts.
Each of the next lines contains two integers and - a trail joining outpost and outpost , walkable in both directions.
Outposts are numbered to . The trails always join all the outposts without closing a loop, so they form a tree.
Output
For every testcase print a single line with the number of trails on the longest route in the park.
Example
3 7 1 2 1 3 2 4 3 5 4 6 5 7 4 1 2 1 3 1 4 1
6 2 0
In the first testcase the longest route runs and uses trails. Notice that outpost is not on either end of it - from outpost nothing is more than trails away. In the second testcase every trail meets at outpost , so any two of the others are trails apart. In the third there is a single outpost and nowhere to walk.
Constraints
and
The sum of over all testcases does not exceed