Mission Impossible: Grand Theft Auto

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

문제

Tom Cruise had his car stolen during the filming in Birmingham. You, as the chief police officer, are asked to catch the thief.

Your people are patrolling the countryside, so the criminal can only be in one of nn towns, and the highways between them represent a tree --- that is, there are n1n - 1 bidirectional roads each connecting a pair of towns, and it is possible to traverse from each of them to any other. On each day you can pick any two towns AA and BB (not necessarily distinct) and request a troop which will check every town on the simple path between AA and BB (including both of them). If the thief is in one of these towns then it's game over for him. Otherwise, later that night he can move into any other adjacent town by a single road or stay still in the town where he was.

Since this is a very important case, you are very short of time. More specifically, let mm be the number of leaves in the tree (that is, towns with only one outgoing road). Then you have to come up with a plan of m/2+1\lfloor m/2 \rfloor + 1 days which catches the thief: for each day you tell the corresponding AA and BB for this day, and your goal is to catch the guy independently on his actions between the days.

Find a plan satisfying the requirements. You will have to answer several test cases.

입력

The first line of input contains the only integer TT (1T1001 \leq T \leq 100) --- the number of test cases. TT tests follow.

The first line of each test case contains a single integer nn (2n21052 \leq n \leq 2 \cdot 10^5) --- the number of towns. Each of the next n1n - 1 lines consists of two integers uu and vv separated by space (1u,vn1 \leq u, v \leq n), denoting a road between towns uu and vv.

It is guaranteed that each test case represents a tree, and that the sum of all nn does not exceed 21052 \cdot 10^5.

출력

For each test case, print exactly m/2+1\lfloor m/2 \rfloor + 1 lines, each consisting of two integers AA and BB (1A,Bn1 \le A, B \le n) denoting the endpoints of the corresponding path. If you are sure that you can catch the thief using less operations, just add arbitrary paths at the bottom. One can prove that an answer always exists under these constraints.

힌트

Extra lines in the sample output are to visually separate answers for different cases. You do not have to print them.