There is a Town which has 'N' Houses numbered from 1 to N, connected by 'N-1' bi directional roads which forms a tree structure. The people of the town are addicted to Partying.
For a party, they choose a house, from which the distance to the farthest house is the minimum.
You need to tell what is this minimum distance which we can achieve by choosing a house to party optimally.
The first line contains an integer 'T' - the number of testcases.
The first line of each testcase contains one integer N- the number of House.
Then each of the next N-1 lines contains two integers h1 and h2 meaning that house h1 and h2 is connected by a road.
For each of the testcase , Output an integer denoting the minimum distance to the farthest house from the House choosen to Party.
If we choose the house number 2 to Party, Then we will have the maximum distance as 1 to the farthest nodes.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.