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 CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int mod = 1000000007;
mt19937 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
class segment_tree {
 public:
  long long rmaxq[4 * 100000], rminq[4 * 100000], rsumq[4 * 100000];
  void init() {
    for (int i = 0; i < 4 * 100000; i++) {
      rmaxq[i] = 0;
      rminq[i] = 0;
      rsumq[i] = 0;
    }
  }
  void upd_rminq(int lb, int rb, int tar, int ok, long long val) {
    if (lb == rb) {
      rminq[ok] = val;
      return;
    }
    int mid = (lb + rb) / 2;
    if (tar <= mid) {
      upd_rminq(lb, mid, tar, 2 * ok + 1, val);
    } else {
      upd_rminq(mid + 1, rb, tar, 2 * ok + 2, val);
    }
    rminq[ok] = min(rminq[2 * ok + 1], rminq[2 * ok + 2]);
  }
  long long query_rminq(int lb, int rb, int ok, int lconst, int rconst) {
    if (rconst < lb || lconst > rb) {
      return LLONG_MAX;
    }
    if (lconst <= lb && rb <= rconst) {
      return rminq[ok];
    }
    int mid = (lb + rb) / 2;
    return min(query_rminq(lb, mid, ok * 2 + 1, lconst, rconst),
               query_rminq(mid + 1, rb, ok * 2 + 2, lconst, rconst));
  }
  void updall_rminq(long long arr[], int n) {
    for (int i = 0; i < n; i++) upd_rminq(0, 100000 - 1, i, 0, arr[i]);
  }
  void upd_rmaxq(int lb, int rb, int tar, int ok, long long val) {
    if (lb == rb) {
      rmaxq[ok] = val;
      return;
    }
    int mid = (lb + rb) / 2;
    if (tar <= mid) {
      upd_rmaxq(lb, mid, tar, 2 * ok + 1, val);
    } else {
      upd_rmaxq(mid + 1, rb, tar, 2 * ok + 2, val);
    }
    rmaxq[ok] = max(rmaxq[2 * ok + 1], rmaxq[2 * ok + 2]);
  }
  long long query_rmaxq(int lb, int rb, int ok, int lconst, int rconst) {
    if (rconst < lb || lconst > rb) {
      return LLONG_MIN;
    }
    if (lconst <= lb && rb <= rconst) {
      return rmaxq[ok];
    }
    int mid = (lb + rb) / 2;
    return max(query_rmaxq(lb, mid, ok * 2 + 1, lconst, rconst),
               query_rmaxq(mid + 1, rb, ok * 2 + 2, lconst, rconst));
  }
  void updall_rmaxq(long long arr[], int n) {
    for (int i = 0; i < n; i++) {
      upd_rmaxq(0, 100000 - 1, i, 0, arr[i]);
    }
  }
  void upd_rsumq(int lb, int rb, int tar, int ok, long long val) {
    if (lb == rb) {
      rsumq[ok] = val;
      return;
    }
    int mid = (lb + rb) / 2;
    if (tar <= mid) {
      upd_rsumq(lb, mid, tar, 2 * ok + 1, val);
    } else {
      upd_rsumq(mid + 1, rb, tar, 2 * ok + 2, val);
    }
    rsumq[ok] = rsumq[2 * ok + 1] + rsumq[2 * ok + 2];
  }
  long long query_rsumq(int lb, int rb, int ok, int lconst, int rconst) {
    if (rconst < lb || lconst > rb) {
      return 0;
    }
    if (lconst <= lb && rb <= rconst) {
      return rsumq[ok];
    }
    int mid = (lb + rb) / 2;
    return query_rsumq(lb, mid, ok * 2 + 1, lconst, rconst) +
           query_rsumq(mid + 1, rb, ok * 2 + 2, lconst, rconst);
  }
  void updall_rsumq(long long arr[], int n) {
    for (int i = 0; i < n; i++) upd_rsumq(0, 100000 - 1, i, 0, arr[i]);
  }
} st;
class set_union {
 public:
  int a[100000 + 1];
  void init() {
    for (int i = 0; i <= 100000; i++) a[i] = i;
  }
  int set_of(int u) {
    if (a[u] == u)
      return u;
    else
      return a[u] = set_of(a[u]);
  }
  void union_(int u, int v) { a[set_of(u)] = set_of(v); }
  struct SEGT {
    int index;
    char type;
  };
  SEGT make_SEGT(int a, char b) {
    SEGT esgewqt = {a, b};
    return esgewqt;
  }
  class SEGT_COMP {
   public:
    bool operator()(SEGT a, SEGT b) {
      if (a.index == b.index)
        return a.type < b.type;
      else
        return a.index > b.index;
    }
  };
  vector<pair<int, int> > segment_union(vector<pair<int, int> > V, int T) {
    for (int i = 0; i < V.size(); i++) {
      if (V[i].first > V[i].second) {
        swap(V[i].first, V[i].second);
      }
    }
    priority_queue<SEGT, vector<SEGT>, SEGT_COMP> segt_pq1;
    for (int i = 0; i < V.size(); i++) {
      segt_pq1.push(make_SEGT(V[i].first - T, 'S'));
      segt_pq1.push(make_SEGT(V[i].second, 'E'));
    }
    stack<SEGT> process;
    vector<pair<int, int> > UwU;
    while (segt_pq1.size()) {
      if (segt_pq1.top().type == 'E') {
        process.pop();
        if (process.size() == 0) {
          UwU[int(UwU.size()) - 1].second = segt_pq1.top().index;
        }
      } else {
        process.push(segt_pq1.top());
        if (process.size() == 1) {
          UwU.push_back({segt_pq1.top().index + T, 0});
        }
      }
      segt_pq1.pop();
    }
    return UwU;
  }
} su;
void include() {}
int maxcomponents[100001];
vector<int> adjlist[100001];
bool visited[100001];
int n;
int ah;
int dfs(int node) {
  if (visited[node] == false) {
    visited[node] = true;
    int cnt = 1, maxi = 0;
    for (int i = 0; i < adjlist[node].size(); i++) {
      if (visited[adjlist[node][i]] == false) {
        int x = dfs(adjlist[node][i]);
        cnt += x;
        maxi = max(maxi, x);
      }
    }
    if (maxi == 0) ah = node;
    maxi = max(maxi, n - cnt);
    maxcomponents[node] = maxi;
    return cnt;
  }
}
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    visited[i] = false;
    adjlist[i].clear();
    maxcomponents[i] = 0;
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adjlist[u].push_back(v);
    adjlist[v].push_back(u);
  }
  dfs(1);
  int centroid = 0;
  int maxi = INT_MAX;
  for (int i = 1; i <= n; i++) maxi = min(maxi, maxcomponents[i]);
  for (int i = 1; i <= n; i++) {
    if (maxcomponents[i] == maxi) {
      centroid++;
    }
  }
  if (centroid == 1) {
    cout << 1 << " " << adjlist[1][0] << "\n";
    cout << 1 << " " << adjlist[1][0] << "\n";
  } else {
    int F = -1, S = -1;
    for (int i = 1; i <= n; i++) {
      if (maxcomponents[i] == maxi) {
        if (F == -1)
          F = i;
        else
          S = i;
      }
    }
    for (int i = 1; i <= n; i++) visited[i] = false;
    visited[S] = true;
    dfs(F);
    cout << adjlist[ah][0] << " " << ah << "\n";
    cout << S << " " << ah << "\n";
    return;
  }
}
int main() {
  srand(time(NULL));
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  include();
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}