Problem: You are given an undirected unweighted tree consisting of n vertices.

An undirected tree is a connected undirected graph with n - 1 edges.

Your task is to choose two pairs of vertices of this tree (all the chosen vertices should be distinct) (x_1, y_1) and (x_2, y_2) in such a way that neither x_1 nor y_1 belong to the simple path from x_2 to y_2 and vice versa (neither x_2 nor y_2 should not belong to the simple path from x_1 to y_1).

It is guaranteed that it is possible to choose such pairs for the given tree.

Among all possible ways to choose such pairs you have to choose one with the maximum number of common vertices between paths from x_1 to y_1 and from x_2 to y_2. And among all such pairs you have to choose one with the maximum total length of these two paths.

It is guaranteed that the answer with at least two common vertices exists for the given tree.

The length of the path is the number of edges in it.

The simple path is the path that visits each vertex at most once.

Input

The first line contains an integer n — the number of vertices in the tree (6 ≤ n ≤ 2 ⋅ 10^5).

Each of the next n - 1 lines describes the edges of the tree.

Edge i is denoted by two integers u_i and v_i, the labels of vertices it connects (1 ≤ u_i, v_i ≤ n, u_i ≠ v_i).

It is guaranteed that the given edges form a tree.

It is guaranteed that the answer with at least two common vertices exists for the given tree.

Output

Print any two pairs of vertices satisfying the conditions described in the problem statement.

It is guaranteed that it is possible to choose such pairs for the given tree.

Examples

Input

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


Output

3 6
7 5


Input

9
9 3
3 5
1 2
4 3
4 7
1 7
4 6
3 8


Output

2 9
6 8


Input

10
6 8
10 3
3 7
5 8
1 7
7 2
2 9
2 8
1 4


Output

10 6
4 5


Input

11
1 2
2 3
3 4
1 5
1 6
6 7
5 8
5 9
4 10
4 11


Output

9 11
8 10

Note

The picture corresponding to the first example: <image>

The intersection of two paths is 2 (vertices 1 and 4) and the total length is 4 + 3 = 7.

The picture corresponding to the second example: <image>

The intersection of two paths is 2 (vertices 3 and 4) and the total length is 5 + 3 = 8.

The picture corresponding to the third example: <image>

The intersection of two paths is 3 (vertices 2, 7 and 8) and the total length is 5 + 5 = 10.

The picture corresponding to the fourth example: <image>

The intersection of two paths is 5 (vertices 1, 2, 3, 4 and 5) and the total length is 6 + 6 = 12.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long MX = 2e5 + 20;
struct TwoPath {
  long long u1, v1;
  long long u2, v2;
  TwoPath() { u1 = v1 = u2 = v2 = -1; }
  TwoPath(long long u1, long long u2, long long v1, long long v2)
      : u1(u1), v1(v1), u2(u2), v2(v2) {}
};
struct Node {
  long long maxD3;
  long long max1D;
  long long max2D;
  long long u, v;
  Node() {
    maxD3 = max1D = max2D = -1;
    u = v = -1;
  }
  Node(long long maxD3, long long max1D, long long max2D, long long u,
       long long v) {
    this->maxD3 = maxD3;
    this->max1D = max1D;
    this->max2D = max2D;
    this->u = u;
    this->v = v;
  }
};
bool cmp(const Node &A, const Node &B) {
  if (A.maxD3 != B.maxD3) {
    return A.maxD3 > B.maxD3;
  }
  return A.max1D + A.max2D > B.max1D + B.max2D;
}
Node getBest(const Node &A, const Node &B) {
  if (A.maxD3 != B.maxD3) {
    if (A.maxD3 < B.maxD3) {
      return A;
    } else {
      return B;
    }
  }
  if (A.max2D + A.max1D > B.max1D + B.max2D) {
    return A;
  } else {
    return B;
  }
}
vector<long long> adj[MX];
Node dp[MX];
pair<long long, long long> maxDepth[MX];
long long maxCommonNodes[MX];
long long maxTotalLenght[MX];
TwoPath choice[MX];
void dfs(long long u = 0, long long d = 0, long long p = -1) {
  for (long long v : adj[u]) {
    if (v != p) {
      dfs(v, d + 1, u);
    }
  }
  maxDepth[u] = {d, u};
  for (long long v : adj[u]) {
    if (v != p) {
      maxDepth[u] = max(maxDepth[u], maxDepth[v]);
    }
  }
  if (adj[u].size() >= 3) {
    vector<pair<long long, long long>> maxDepthCandidates;
    for (long long v : adj[u]) {
      if (v != p) {
        maxDepthCandidates.push_back(maxDepth[v]);
      }
    }
    sort(maxDepthCandidates.rbegin(), maxDepthCandidates.rend());
    dp[u] = Node(d, maxDepthCandidates[0].first, maxDepthCandidates[1].first,
                 maxDepthCandidates[0].second, maxDepthCandidates[1].second);
  }
  for (long long v : adj[u]) {
    if (v != p) {
      if (cmp(dp[v], dp[u])) {
        dp[u] = dp[v];
      }
    }
  }
  vector<Node> candidates;
  for (long long v : adj[u]) {
    if (v != p) {
      if (dp[v].max1D != -1) {
        candidates.push_back(dp[v]);
      }
    }
  }
  if (candidates.size() >= 2) {
    sort(candidates.begin(), candidates.end(), cmp);
    maxCommonNodes[u] = candidates[0].maxD3 + candidates[1].maxD3 - 2 * d + 1;
    maxTotalLenght[u] = 2 * (maxCommonNodes[u] - 1) + candidates[0].max1D +
                        candidates[0].max2D + candidates[1].max1D +
                        candidates[1].max2D - 2 * candidates[0].maxD3 -
                        2 * candidates[1].maxD3;
    choice[u] = TwoPath(candidates[0].u, candidates[0].v, candidates[1].u,
                        candidates[1].v);
  }
}
long long nodes = -1;
long long length = -1;
TwoPath ans;
struct Node2 {
  long long d, u, target;
  Node2() {}
  Node2(long long d, long long u, long long target)
      : d(d), u(u), target(target) {}
};
bool cmp2(const Node2 &A, const Node2 &B) { return A.d > B.d; }
void dfs2(long long u, Node parent, vector<Node2> candidatesP = {},
          long long d = 0, long long p = -1) {
  vector<Node2> candidates;
  for (long long v : adj[u]) {
    if (v != p) {
      candidates.push_back(Node2(maxDepth[v].first - d, v, maxDepth[v].second));
    }
  }
  sort(candidates.begin(), candidates.end(), cmp2);
  if (adj[u].size() >= 3 && parent.max1D != -1) {
    long long curNodes = d - parent.maxD3 + 1;
    long long curLength = (curNodes - 1) * 2 + parent.max1D + parent.max2D +
                          candidates[0].d + candidates[1].d;
    if (curNodes > nodes) {
      nodes = curNodes;
      length = curLength;
      ans = TwoPath(parent.u, parent.v, candidates[0].target,
                    candidates[1].target);
    } else if (curNodes == nodes && curLength > length) {
      nodes = curNodes;
      length = curLength;
      ans = TwoPath(parent.u, parent.v, candidates[0].target,
                    candidates[1].target);
    }
  }
  vector<Node2> candidatesChildren = candidates;
  for (Node2 x : candidatesP) {
    candidates.push_back(x);
  }
  sort(candidates.begin(), candidates.end(), cmp2);
  if (candidates.size() < 3) {
    for (long long v : adj[u]) {
      if (v != p) {
        vector<Node2> curCand = candidatesP;
        for (long long i = 0; i < min(3, (int)candidatesChildren.size()); i++) {
          if (candidatesChildren[i].u != v) {
            curCand.push_back(candidatesChildren[i]);
          }
        }
        sort(curCand.begin(), curCand.end(), cmp2);
        while (curCand.size() > 2) curCand.pop_back();
        if (parent.maxD3 == -1)
          for (Node2 &x : curCand) x.d++;
        dfs2(v, parent, curCand, d + 1, u);
      }
    }
  } else {
    if (parent.maxD3 == -1) {
      parent.maxD3 = d;
    }
    for (long long v : adj[u]) {
      if (v != p) {
        if (candidates[0].u != v) {
          if (candidates[1].u != v) {
            parent.max1D = candidates[0].d;
            parent.max2D = candidates[1].d;
            parent.u = candidates[0].target;
            parent.v = candidates[1].target;
          } else {
            parent.max1D = candidates[0].d;
            parent.max2D = candidates[2].d;
            parent.u = candidates[0].target;
            parent.v = candidates[2].target;
          }
        } else {
          parent.max1D = candidates[1].d;
          parent.max2D = candidates[2].d;
          parent.u = candidates[1].target;
          parent.v = candidates[2].target;
        }
        vector<Node2> curCand = candidatesP;
        for (long long i = 0; i < min(3, (int)candidatesChildren.size()); i++) {
          if (candidatesChildren[i].u != v) {
            curCand.push_back(candidatesChildren[i]);
          }
        }
        sort(curCand.begin(), curCand.end(), cmp2);
        while (curCand.size() > 2) curCand.pop_back();
        dfs2(v, parent, curCand, d + 1, u);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (long long i = 0; i < n; i++) {
    maxCommonNodes[i] = maxTotalLenght[i] = 0;
  }
  dfs();
  for (long long u = 0; u < n; u++) {
    if (maxCommonNodes[u] > nodes) {
      nodes = maxCommonNodes[u];
      length = maxTotalLenght[u];
      ans = choice[u];
    } else if (maxCommonNodes[u] == nodes && maxTotalLenght[u] > length) {
      nodes = maxCommonNodes[u];
      length = maxTotalLenght[u];
      ans = choice[u];
    }
  }
  dfs2(0, Node());
  cout << ans.u1 + 1 << " " << ans.v1 + 1 << endl;
  cout << ans.u2 + 1 << " " << ans.v2 + 1 << endl;
  return 0;
}