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;
int const mod = 998244353;
int const inf = 2e18;
inline int add(int a, int b) { return (a % mod + b % mod + mod) % mod; }
inline int mul(int a, int b) { return (a % mod * b % mod + mod) % mod; }
inline int sub(int a, int b) { return (a % mod - b % mod + mod) % mod; }
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int modexp(int x, int n) {
  if (n == 0) {
    return 1;
  } else if (n & 1) {
    return (modexp((x * x) % mod, n / 2) % mod * x % mod) % mod;
  } else {
    return (modexp((x * x) % mod, n / 2) % mod);
  }
}
int modinv(int n) { return modexp(n, mod - 2); }
template <class T>
void dispvector(vector<T> v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << "\n";
}
const int N = 2e5 + 5;
vector<int> g[N];
int n;
bool ok = 0;
struct item {
  int htl;
  int dial;
  int de1;
  int de2;
  int he1;
};
item dfs(int v, int pa) {
  int dial = 0;
  int ht1 = 0;
  int ht2 = 0;
  int he1 = v;
  int he2 = v;
  int de1 = v;
  int de2 = v;
  for (int u : g[v]) {
    if (u != pa) {
      item rem = dfs(u, v);
      if (rem.htl >= ht1) {
        ht2 = ht1;
        he2 = he1;
        ht1 = rem.htl;
        he1 = rem.he1;
      } else if (rem.htl > ht2) {
        ht2 = rem.htl;
        he2 = rem.he1;
      }
      if (rem.dial > dial) {
        dial = rem.dial;
        de1 = rem.de1;
        de2 = rem.de2;
      }
    }
  }
  if (ht1 + ht2 + 1 > dial) {
    dial = ht1 + ht2 + 1;
    de1 = he1;
    de2 = he2;
  }
  if (ht1 > ht2) {
    return {ht1 + 1, dial, de1, de2, he1};
  } else {
    return {ht2 + 1, dial, de1, de2, he2};
  }
}
void dfs2(int v, int pa, set<int>& mydia, int cht, int& ht, int& rr) {
  if (cht > ht) {
    ht = cht;
    rr = v;
  }
  for (int u : g[v]) {
    if (u != pa && !mydia.count(u)) {
      dfs2(u, v, mydia, cht + 1, ht, rr);
    }
  }
}
void dfs3(int v, int pa, int& t, set<int>& mydia) {
  if (v == t) {
    mydia.insert(v);
    ok = 1;
    return;
  }
  for (int u : g[v]) {
    if (u != pa) {
      mydia.insert(v);
      dfs3(u, v, t, mydia);
      if (ok) return;
      mydia.erase(v);
    }
  }
}
void solve() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int root = -1;
  for (int i = 1; i < n + 1; i++) {
    if (g[i].size() == 1) root = i;
  }
  int ans = 0;
  item rem = dfs(root, root);
  int v1 = rem.de1;
  int v2 = rem.de2;
  set<int> mydia;
  dfs3(v1, v1, v2, mydia);
  ans += rem.dial;
  int mx = 0;
  int mxv = 0;
  for (int i = 1; i < n + 1; i++) {
    if (mydia.count(i)) {
      int ht = 0;
      int rr = i;
      dfs2(i, i, mydia, 0, ht, rr);
      if (ht > mx) {
        mx = ht;
        mxv = rr;
      }
    }
  }
  ans += mx;
  cout << ans - 1 << "\n";
  cout << v1 << " " << v2 << " ";
  if (mx != 0) {
    cout << mxv << "\n";
  } else {
    for (int i = 1; i < n + 1; i++) {
      if (i != v1 && i != v2) {
        cout << i << "\n";
        break;
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  for (int i = 1; i <= tc; i++) {
    solve();
  }
  return 0;
}