Problem: You are given an unweighted tree with n vertices. Recall that a tree is a connected undirected graph without cycles.

Your task is to choose three distinct vertices a, b, c on this tree such that the number of edges which belong to at least one of the simple paths between a and b, b and c, or a and c is the maximum possible. See the notes section for a better understanding.

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

Input

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

Next n - 1 lines describe the edges of the tree in form a_i, b_i (1 ≤ a_i, b_i ≤ n, a_i ≠ b_i). It is guaranteed that given graph is a tree.

Output

In the first line print one integer res — the maximum number of edges which belong to at least one of the simple paths between a and b, b and c, or a and c.

In the second line print three integers a, b, c such that 1 ≤ a, b, c ≤ n and a ≠, b ≠ c, a ≠ c.

If there are several answers, you can print any.

Example

Input


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


Output


5
1 8 6

Note

The picture corresponding to the first example (and another one correct answer):

<image>

If you choose vertices 1, 5, 6 then the path between 1 and 5 consists of edges (1, 2), (2, 3), (3, 4), (4, 5), the path between 1 and 6 consists of edges (1, 2), (2, 3), (3, 4), (4, 6) and the path between 5 and 6 consists of edges (4, 5), (4, 6). The union of these paths is (1, 2), (2, 3), (3, 4), (4, 5), (4, 6) so the answer is 5. It can be shown that there is no better answer.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, LOG = 20;
int n;
vector<int> g[N];
int h[N], up[LOG][N];
pair<int, int> mx[2][N];
vector<int> leaves;
void dfs(int v, int p) {
  up[0][v] = p;
  for (int i = 1; i < LOG; ++i) {
    up[i][v] = up[i - 1][up[i - 1][v]];
  }
  mx[0][v] = make_pair(0, v);
  mx[1][v] = make_pair(0, v);
  bool is_leaf = true;
  for (int &u : g[v]) {
    if (u == p) {
      continue;
    }
    is_leaf = false;
    h[u] = h[v] + 1;
    dfs(u, v);
    if (mx[0][v].first <= mx[0][u].first + 1) {
      mx[1][v] = mx[0][v];
      mx[0][v].first = mx[0][u].first + 1;
      mx[0][v].second = mx[0][u].second;
    } else if (mx[1][v].first < mx[0][u].first + 1) {
      mx[1][v].first = mx[0][u].first + 1;
      mx[1][v].second = mx[0][u].second;
    }
  }
  if (is_leaf) {
    leaves.push_back(v);
  }
}
int getLA(int v, int k) {
  for (int i = 0; i < LOG; ++i) {
    if ((k >> i) & 1) {
      v = up[i][v];
    }
  }
  return v;
}
int getLCA(int v, int u) {
  if (h[v] < h[u]) {
    u = getLA(u, h[u] - h[v]);
  }
  if (h[u] < h[v]) {
    v = getLA(v, h[v] - h[u]);
  }
  if (v == u) {
    return v;
  }
  for (int i = LOG - 1; i > -1; --i) {
    int v1 = up[i][v], u1 = up[i][u];
    if (v1 != u1) {
      v = v1;
      u = u1;
    }
  }
  return up[0][v];
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
  if (strlen("") > 0)
    freopen(
        ""
        ".in",
        "r", stdin),
        freopen(
            ""
            ".out",
            "w", stdout);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int v, u;
    cin >> v >> u;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  dfs(1, 1);
  vector<pair<pair<int, int>, int>> vars;
  for (int i = 1; i <= n; ++i) {
    int curr_len = mx[0][i].first + mx[1][i].first;
    if (curr_len > 0) {
      vars.push_back(make_pair(make_pair(curr_len, h[i]), i));
    }
  }
  sort(vars.rbegin(), vars.rend());
  pair<pair<int, int>, pair<int, int>> answ;
  for (int idx = 0; idx < min(5, (int)vars.size()); ++idx) {
    int a = mx[0][vars[idx].second].second, b = mx[1][vars[idx].second].second,
        lca = getLCA(a, b);
    pair<int, int> curr = make_pair(0, 0);
    for (int i = 1; i <= n; ++i) {
      if (a != i && b != i) {
        curr.second = i;
        break;
      }
    }
    for (int &c : leaves) {
      if (a == c || b == c) {
        continue;
      }
      int lll = getLCA(lca, c);
      if (lll == lca) {
        int A = getLCA(a, c), B = getLCA(b, c);
        if (A == lca && B == lca) {
          curr = max(curr, make_pair(h[c] - h[lca], c));
        } else if (A == lca) {
          curr = max(curr, make_pair(h[c] - h[B], c));
        } else {
          curr = max(curr, make_pair(h[c] - h[A], c));
        }
      } else {
        curr = max(curr, make_pair(h[lll] - h[c] + h[lll] - h[lca], c));
      }
    }
    answ = max(answ, make_pair(make_pair(curr.first + vars[idx].first.first, a),
                               make_pair(b, curr.second)));
  }
  cout << answ.first.first << "\n"
       << answ.first.second << " " << answ.second.first << " "
       << answ.second.second << "\n";
  return 0;
}