JAG Strikes Back

아직 제출이 없습니다시간 제한1초메모리 제한128 MB

문제

JAG is the new revolutionary game of the company BESTBEST. In this game players play TT rounds and in each round they have a map of NN territories. Exactly N1N-1 pairs of these territories have common border. This map is connected, that is, for every two territories uu and vv, you can walk from uu to vv, possibly by crossing some other territories. Players are choosing territories in turns, until all territories are chosen. There are two rules:

  • Moves can't be skipped.
  • Player can't choose territory already chosen by him or the other player.

We define distance between two territories uu and vv as the smallest possible number of borders, that you have to cross on some path from uu to vv. First player's goal is to minimize the distance between two furthest territories chosen by him. Second player's goal is to maximize that distance. Print the distance between two furthest territories chosen by the first player, if both players play in the optimal way.

입력

In the first line of input is the number of rounds TT. Description of TT rounds follows.

For each round, in the first line, there is the number NN (3N1053 \leq N \leq 10^5), representing the number of territories. In the following N1N-1 lines there are two numbers uu and vv, representing pair of territories having common border. It is guaranteed that you can walk from any territory to any other territory by crossing some borders.

It is guaranteed that the sum of NN over all of the rounds doesn't exceed 200000200000.

출력

Print TT lines, in iith of them the distance between two furthest territories of the first player, if both players play in the optimal way.