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 long long mod = (long long)1e9 + 7;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "vector:\t";
  typename vector<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) os << *it << " ";
  return os;
}
void show(long long *a, long long m, long long n) {
  cout << "2D Array\n";
  for (long long i = 0; i < (m); i++) {
    for (long long j = 0; j < (n); j++) {
      cout << *((a + i * n) + j) << " ";
    }
    cout << "\n";
  }
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "set: ";
  typename set<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) os << *it << " ";
  return os;
}
long long power(long long x, long long y) {
  long long res = 1;
  x %= mod;
  assert(y >= 0);
  for (; y; y >>= 1) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod;
  }
  return res;
}
long long modinverse(long long n) { return power(n, mod - 2); }
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &v) {
  os << "multiset:\t";
  typename multiset<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) os << *it << " ";
  return os;
}
template <typename T>
void show(T q) {
  cout << "\npriority_queue:\t";
  while (!q.empty()) {
    cout << q.top() << " ";
    q.pop();
  }
  cout << "\n";
}
template <typename F, typename str>
ostream &operator<<(ostream &os, const map<F, str> &v) {
  os << "map:\t";
  typename map<F, str>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++)
    os << it->first << "->" << it->second << " | ";
  return os;
}
template <typename F, typename str>
ostream &operator<<(ostream &os, const unordered_map<F, str> &v) {
  os << "unordered_map: ";
  typename unordered_map<F, str>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++)
    os << it->first << "->" << it->second << " | ";
  return os;
}
string to_string(const bool b) { return (b ? "true" : "false"); }
template <typename A>
string to_string(vector<A> &v) {
  string s = "";
  s += "(";
  for (A &x : v) s += to_string(x) + " ";
  s += ")";
  return s;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; };
long long gcdextended(long long a, long long m) {
  for (a > m ? (a ^= m ^= a ^= m) : a; a; a ^= m ^= a ^= m) m -= (m / a) * a;
  return m;
}
template <typename T>
void show(T arr, long long n) {
  cout << "\narray :\t";
  for (long long i = 0; i < (n); i++) {
    cout << arr[i] << " ";
  }
  cerr << "\n";
}
string to_string(const string s, long long x1 = 0, long long x2 = 1e9) {
  return '"' + ((x1 < s.size()) ? s.substr(x1, x2 - x1 + 1) : "") + '"';
}
string to_string(const char *s) { return to_string((string)s); }
string to_string(char c) { return string(1, c); }
void debug() { cerr << "\n"; }
template <typename Head, typename... Tail>
void debug(Head H, Tail... T) {
  cerr << to_string(H) << " | ";
  debug(T...);
}
void console() { ; }
template <typename Head, typename... Tail>
void console(Head H, Tail... T) {
  cerr << H << "\n";
  console(T...);
}
vector<long long> p;
vector<vector<long long> > g;
pair<long long, long long> dfs(long long v, long long par = -1,
                               long long dist = 0) {
  p[v] = par;
  pair<long long, long long> res = make_pair(dist, v);
  for (auto to : g[v]) {
    if (to == par) continue;
    res = max(res, dfs(to, v, dist + 1));
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, u, v;
  cin >> n;
  p = vector<long long>(n);
  g = vector<vector<long long> >(n);
  for (long long i = 0; i < (n - 1); i++) {
    cin >> u >> v;
    u--;
    v--;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  pair<long long, long long> da = dfs(0);
  pair<long long, long long> db = dfs(da.second);
  long long ver = db.second;
  vector<long long> diameters;
  while (ver != da.second) {
    diameters.emplace_back(ver);
    ver = p[ver];
  }
  diameters.emplace_back(da.second);
  if (diameters.size() == n) {
    cout << n - 1 << "\n"
         << diameters.front() + 1 << " " << diameters[1] + 1 << " "
         << diameters.back() + 1 << "\n";
  } else {
    queue<long long> q;
    vector<long long> d(n, -1);
    for (auto v : diameters) {
      d[v] = 0;
      q.push(v);
    }
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (auto to : g[v]) {
        if (d[to] == -1) {
          d[to] = d[v] + 1;
          q.push(to);
        }
      }
    }
    pair<long long, long long> mx = make_pair(d[0], 0);
    for (long long v = 1; v < n; ++v) {
      mx = max(mx, make_pair(d[v], v));
    }
    cout << (long long)(diameters.size()) - 1 + mx.first << endl
         << diameters[0] + 1 << " " << mx.second + 1 << " "
         << diameters.back() + 1 << endl;
  }
  return 0;
}