1406_C. Link Cut Centroids
Fishing Prince loves trees, and he especially loves trees with only one centroid. The tree is a connected graph without cycles.

A vertex is a centroid of a tree only when you cut this vertex (remove it and remove all edges from this vertex), the size of the largest connected component of the remaining graph is the smallest possible.

For example, the centroid of the following tree is 2, because when you cut it, the size of the largest connected component of the remaining graph is 2 and it can't be smaller.

<image>

However, in some trees, there might be more than one centroid, for example:

<image>

Both vertex 1 and vertex 2 are centroids because the size of the largest connected component is 3 after cutting each of them.

Now Fishing Prince has a tree. He should cut one edge of the tree (it means to remove the edge). After that, he should add one edge. The resulting graph after these two operations should be a tree. He can add the edge that he cut.

He wants the centroid of the resulting tree to be unique. Help him and find any possible way to make the operations. It can be proved, that at least one such way always exists.

Input

The input consists of multiple test cases. The first line contains an integer t (1≤ t≤ 10^4) — the number of test cases. The description of the test cases follows.

The first line of each test case contains an integer n (3≤ n≤ 10^5) — the number of vertices.

Each of the next n-1 lines contains two integers x, y (1≤ x,y≤ n). It means, that there exists an edge connecting vertices x and y.

It's guaranteed that the given graph is a tree.

It's guaranteed that the sum of n for all test cases does not exceed 10^5.

Output

For each test case, print two lines.

In the first line print two integers x_1, y_1 (1 ≤ x_1, y_1 ≤ n), which means you cut the edge between vertices x_1 and y_1. There should exist edge connecting vertices x_1 and y_1.

In the second line print two integers x_2, y_2 (1 ≤ x_2, y_2 ≤ n), which means you add the edge between vertices x_2 and y_2.

The graph after these two operations should be a tree.

If there are multiple solutions you can print any.

Example

Input


2
5
1 2
1 3
2 4
2 5
6
1 2
1 3
1 4
2 5
2 6


Output


1 2
1 2
1 3
2 3

Note

Note that you can add the same edge that you cut.

In the first test case, after cutting and adding the same edge, the vertex 2 is still the only centroid.

In the second test case, the vertex 2 becomes the only centroid after cutting the edge between vertices 1 and 3 and adding the edge between vertices 2 and 3.
```python
from random import choice as _choice
import sys as _sys


def main():
    t = int(input())
    for i in range(t):
        n, = _read_ints()
        graph = [set() for v in range(n)]
        for i_edge in range(n-1):
            v1, v2 = _read_ints()
            v1 -= 1
            v2 -= 1
            graph[v1].add(v2)
            graph[v2].add(v1)
        operations = find_operations_necessary_to_remain_one_centroid(graph)
        for v1, v2 in operations:
            print(v1+1, v2+1)


def _read_line():
    result = _sys.stdin.readline()
    assert result[-1] == "\n"
    return result[:-1]


def _read_ints():
    return map(int, _read_line().split(" "))


def find_operations_necessary_to_remain_one_centroid(graph):
    assert len(graph) > 2
    graph = [set(neighbors) for neighbors in graph]
    
    centroids = find_centroids(graph)
    assert 0 < len(centroids) <= 2
    
    if len(centroids) == 1:
        operation_remove = (0, tuple(graph[0])[0])
        operation_add = operation_remove
    
    else:
        assert len(centroids) == 2
        centroid_1, centroid_2 = centroids
        
        vertex_to_move = centroid_1
        forbidden_vertex = centroid_2
        while len(graph[vertex_to_move]) != 1:
            neighbors = tuple(graph[vertex_to_move])
            new_vertex_to_move = neighbors[0]
            if new_vertex_to_move == forbidden_vertex:
                new_vertex_to_move = neighbors[1]
            forbidden_vertex = vertex_to_move
            vertex_to_move = new_vertex_to_move
        
        vertex_to_move_parent = tuple(graph[vertex_to_move])[0]
        operation_remove = (vertex_to_move, vertex_to_move_parent)
        graph[vertex_to_move].remove(vertex_to_move_parent)
        graph[vertex_to_move_parent].remove(vertex_to_move)
        assert len(graph[vertex_to_move]) == 0
        
        new_parent = centroid_2
        graph[vertex_to_move].add(new_parent)
        graph[new_parent].add(vertex_to_move)
        
        operation_add = (vertex_to_move, new_parent)
    
    return operation_remove, operation_add


def find_centroids(graph):
    vertices_n = len(graph)
    vertices_values = [None] * len(graph)
    
    leaves = [vertex for vertex in range(len(graph)) if len(graph[vertex]) == 1]
    vertices_accumulated = [None] * len(graph)
    for leave in leaves:
        vertices_accumulated[leave] = 1
        vertices_values[leave] = vertices_n - 1
    
    active = set().union(*(graph[leave] for leave in leaves))
    passed = set(leaves)
    active -= passed
    while len(passed) < len(graph):
        old_active = active
        active = set()
        for vertex in old_active:
            neighbors = graph[vertex]
            neighbors_not_passed = neighbors - passed
            if len(neighbors_not_passed) > 1:
                active.add(vertex)
                continue
            vertices_accumulated[vertex] = sum(
                vertices_accumulated[neighbor] for neighbor in neighbors if neighbor in passed
            ) + 1
            components_remain_sizes = []
            for neighbor in neighbors - neighbors_not_passed:
                components_remain_sizes.append(vertices_accumulated[neighbor])
            assert len(neighbors_not_passed) <= 1
            for neighbor in neighbors_not_passed:
                components_remain_sizes.append(vertices_n - vertices_accumulated[vertex])
            vertex_value = max(components_remain_sizes)
            vertices_values[vertex] = vertex_value
            passed.add(vertex)
            active.update(neighbors_not_passed)
        active = active - passed
    
    centroid_value = min(vertices_values)
    centroids = [vertex for vertex, value in enumerate(vertices_values) if value == centroid_value]
    return centroids


if __name__ == '__main__':
    main()

```