Problem: 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.

Solution (in JAVA):

Solution:

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;

public class Round659 {

	static int rec = 0;
	static int X[] = { -1, 0, 0, 1 };
	static int Y[] = { 0, -1, 1, 0 };
	static long mod = 1000000007;
	static int last = 0;
	static int maxDepth = 0;

	static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[64]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}

	public static long[] initArray(int n, Reader scan) throws IOException {

		long arr[] = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = scan.nextLong();
		}

		return arr;
	}

	public static long sum(long arr[]) {

		long sum = 0;
		for (long i : arr) {
			sum += (long) i;
		}

		return sum;
	}

	public static long max(long arr[]) {

		long max = Long.MIN_VALUE;

		for (long i : arr) {
			max = Math.max(i, max);
		}

		return max;
	}

	public static long min(long arr[]) {
		long min = Long.MAX_VALUE;

		for (long i : arr) {
			min = Math.min(i, min);
		}

		return min;
	}
	
	public static int[] intArray(int n, Reader scan) throws IOException {
		
		int arr[]=new int[n];
		
		for(int i=0;i<n;i++) {
			arr[i]=scan.nextInt();
		}
		
		return arr;
		
	}

	public static List<Integer>[] initAdjacency(int n, int e, Reader scan, boolean type) throws IOException {

		List<Integer> adj[] = new ArrayList[n + 1];

		for (int i = 0; i < e; i++) {
			int u = scan.nextInt();
			int v = scan.nextInt();

			if (adj[u] == null)
				adj[u] = new ArrayList<>();
			if (type && adj[v] == null)
				adj[v] = new ArrayList<>();

			adj[u].add(v);

			if (type)
				adj[v].add(u);

		}

		return adj;
	}
	
	public static int[] nextGreater(int arr[]) {
		
		int n=arr.length;
		int nextGreater[] = new int[n];

		Stack<Integer> stack = new Stack<>();

		for (int i = 0; i < n; i++) {

			while (!stack.isEmpty()) {

				if (arr[i] >= arr[stack.peek()]) {
					nextGreater[stack.pop()] = i;
				} else {
					break;
				}

			}

			stack.push(i);

		}

		while (!stack.isEmpty()) {
			nextGreater[stack.pop()] = n;
		}
		
		return nextGreater;

	}
	
	public static int[] nextGreater(long arr[]) {
		
		int n=arr.length;
		int nextGreater[] = new int[n];

		Stack<Integer> stack = new Stack<>();

		for (int i = 0; i < n; i++) {

			while (!stack.isEmpty()) {

				if (arr[i] >= arr[stack.peek()]) {
					nextGreater[stack.pop()] = i;
				} else {
					break;
				}

			}

			stack.push(i);

		}

		while (!stack.isEmpty()) {
			nextGreater[stack.pop()] = n;
		}
		
		return nextGreater;

	}
	
	public static int[] nextSmaller(int[] arr) {
		int n=arr.length;
		
		Stack<Integer> stack=new Stack<>();
		int nextSmaller[] = new int[n];

		for (int i = 0; i < n; i++) {

			while (!stack.isEmpty()) {

				if (arr[i] <= arr[stack.peek()]) {
					nextSmaller[stack.pop()] = i;
				} else {
					break;
				}

			}

			stack.push(i);

		}

		while (!stack.isEmpty()) {
			nextSmaller[stack.pop()] = n;
		}

		return nextSmaller;
	}
	
	public static int[] nextSmaller(long[] arr) {
		int n=arr.length;
		
		Stack<Integer> stack=new Stack<>();
		int nextSmaller[] = new int[n];

		for (int i = 0; i < n; i++) {

			while (!stack.isEmpty()) {

				if (arr[i] <= arr[stack.peek()]) {
					nextSmaller[stack.pop()] = i;
				} else {
					break;
				}

			}

			stack.push(i);

		}

		while (!stack.isEmpty()) {
			nextSmaller[stack.pop()] = n;
		}

		return nextSmaller;
	}

	public static void main(String[] args) throws IOException {

		Reader scan = new Reader();
//		Scanner scan = new Scanner(System.in);

		int t = scan.nextInt();
		while (t-- > 0) {
//
//			int n=scan.nextInt();
//			
//			long arr[]=initArray(n, scan);
////			int arr[]=intArray(n, scan);
//			B(n, arr);
			C(scan);
		
		}

	}
	
	public static void C(Reader scan) throws IOException {
		
		int n=scan.nextInt();
		
		List<Integer> adj[]=initAdjacency(n, n-1, scan, true);
		
		int total[]=new int[n+1];
		
		Map<Long, Integer> map=new HashMap<>();
		
		long val= n+1;
		
		int max[]=new int[n+1];
		getCount(1, 0, adj, map, total, val,max);
		
		getMaxVals(1, 0, adj, total, max, val);
		
		int min=Integer.MAX_VALUE;
		int count=0;
		int node1=0;
		int node2=0;
		for(int i=1;i<=n;i++) {
			
			if(max[i]<min) {
				min=max[i];
				count=1;
				node1=i;
			}else if(max[i]==min) {
				count++;
				node2=i;
			}
			
		}
		
		if(count==1) {
			
			for(Integer x: adj[node1]) {
				
				System.out.println(node1+" "+x);
				System.out.println(node1+" "+x);
				return;
			}
			
		}
		
		for(Integer x: adj[node2]) {
			
			if(x==node1) continue;
			
			System.out.println(node2+" "+x);
			System.out.println(node1+" "+x);
			return;
		}
		
		
		
	}
	
	public static void getMaxVals(int i, int parent, List<Integer> adj[], int total[], int max[], long val) {
		
		if(i!=1) {
			
			int rem= total[parent]-total[i];
			
			max[i]=Math.max(max[i], rem);
			
			total[i]+= rem;
			
		}
		
		for(Integer x: adj[i]) {
			if(x==parent) continue;
			
			getMaxVals(x, i, adj, total, max, val);
		}
		
		
	}
	
	public static int getCount(int i, int parent, List<Integer> adj[], Map<Long, Integer> map, int total[], long val, int max[]) {
		
		for(Integer x: adj[i]) {
			if(x==parent) continue;
			
			int recAns= getCount(x, i, adj, map, total,val,max);
			
			long key= ((long)i*(val))+(long)x;
			
			map.put(key, recAns);
			max[i]=Math.max(max[i], recAns);
			total[i]+= recAns;
		}
		
		total[i]+=1;
		
		return total[i];
		
	}
	
	

	public static void A(int n, int arr[]) {
		
		
		int count[]=new int[102];
		
		for(int i: arr) {
			count[i]++;
		}
		
		
		int first=0;
		
		for(int i=0;i<count.length;i++) {
			if(count[i]<2) {
				if(count[i]==0) {
					System.out.println(2*i);
					return;
				}
				
				first=i;
				break;
			}
		}
		
		for(int i=first+1;i<count.length;i++) {
			if(count[i]==0) {
				first+=i;
				break;
			}
		}
		
		System.out.println(first);
		
	}
	
	public static void B(int n, long arr[]) {
		
		Arrays.sort(arr);
		
		List<Long> ans=new ArrayList<>();
		
		ans.add(arr[n-1]*arr[n-2]*arr[n-3]*arr[n-4]*arr[n-5]);
		
		ans.add(arr[n-1]*arr[n-2]*arr[n-3]*arr[n-4]*arr[0]);
		
		ans.add(arr[n-1]*arr[n-2]*arr[n-3]*arr[1]*arr[0]);
		
		ans.add(arr[n-1]*arr[n-2]*arr[2]*arr[1]*arr[0]);
		
		ans.add(arr[n-1]*arr[3]*arr[2]*arr[1]*arr[0]);
		
		ans.add(arr[4]*arr[3]*arr[2]*arr[1]*arr[0]);
		
		Long max=Long.MIN_VALUE;
		
		for(Long val: ans) {
			max=Math.max(max, val);
		}
		
		
		System.out.println(max);
		
		
	}

}

class Range {

	public long rangeMax[][];
	public long rangeMin[][];

	public int indexMax[][];
	public int indexMin[][];

	public Range(long arr[]) {

		double hi = Math.ceil(Math.log(arr.length) / Math.log(2));
		// System.out.println("hi="+hi);
		rangeMax = new long[arr.length][(int) hi + 1];
		rangeMin = new long[arr.length][(int) hi + 1];
		indexMax = new int[arr.length][(int) hi + 1];
		indexMin = new int[arr.length][(int) hi + 1];
		for (int i = 0; i < arr.length; i++) {
			rangeMax[i][0] = arr[i];
			rangeMin[i][0] = arr[i];

			indexMax[i][0] = i;
			indexMin[i][0] = i;
		}

		for (int len = 2, j = 1; len <= arr.length; len *= 2, j++) {

			for (int i = 0; i < arr.length; i++) {

				if (i + len / 2 >= arr.length) {
					rangeMax[i][j] = rangeMax[i][j - 1];
					rangeMin[i][j] = rangeMin[i][j - 1];

					indexMax[i][j] = indexMax[i][j - 1];

					indexMin[i][j] = indexMin[i][j - 1];
					continue;
				}

				rangeMax[i][j] = Math.max(rangeMax[i][j - 1], rangeMax[i + len / 2][j - 1]);
				rangeMin[i][j] = Math.min(rangeMin[i][j - 1], rangeMin[i + len / 2][j - 1]);

				indexMax[i][j] = indexMax[i + len / 2][j - 1];

				indexMin[i][j] = indexMin[i + len / 2][j - 1];

				if (rangeMax[i][j] == rangeMax[i][j - 1]) {
					indexMax[i][j] = indexMax[i][j - 1];
				}

				if (rangeMin[i][j] == rangeMin[i][j - 1]) {
					indexMin[i][j] = indexMin[i][j - 1];
				}

			}

		}

	}

	public int getMax(int l, int r) {

		if (l > r)
			return -1;

		int len = r - l + 1;
		long ans = Long.MIN_VALUE;
		int index = l;
		int cur = l;
		while (len != 0) {
			int val = (int) (Math.log(len) / Math.log(2));
			len -= (1 << val);
			long maxVal = Math.max(ans, rangeMax[cur][val]);

			if (maxVal > ans) {
				index = indexMax[cur][val];
			}

			ans = maxVal;
			cur += (1 << val);
		}

		return index;

	}

	public int getMin(int l, int r) {

		if (l > r)
			return -1;

		int len = r - l + 1;
		long ans = Long.MAX_VALUE;
		int cur = l;
		int index = l;
		while (len != 0) {
			int val = (int) (Math.log(len) / Math.log(2));
			len -= (1 << val);
			long minVal = Math.min(ans, rangeMin[cur][val]);

			if (minVal < ans) {
				index = indexMin[cur][val];
			}

			ans = minVal;

			cur += (1 << val);
		}

		return index;
	}

}

class MyPair {

	int value;
	int weight;

	public MyPair(int value, int w) {
		this.value = value;
		weight = w;
	}

}