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 deep[200200], dp[200200], dp2[200200], num[200200], pre[200200];
vector<pair<int, int> > dp2Ans(200200);
vector<pair<int, pair<int, int> > > ans(200200);
vector<vector<int> > g(200200);
int n, f, f1;
pair<int, pair<int, int> > w;
void build(int ver, int p = -1) {
  deep[ver] = 1;
  pre[ver] = p;
  num[ver] = ver;
  for (int i = 0; i < g[ver].size(); i++) {
    int to = g[ver][i];
    if (to != p) {
      build(to, ver);
      if (deep[to] + 1 > deep[ver]) {
        deep[ver] = deep[to] + 1;
        num[ver] = num[to];
      }
    }
  }
}
void dfs(int ver, int p = -1) {
  vector<int> pref(g[ver].size() + 5, 0);
  vector<int> suf(g[ver].size() + 5, 0);
  vector<int> posPref(g[ver].size() + 5, 0);
  vector<int> posSuf(g[ver].size() + 5, 0);
  pref[0] = suf[g[ver].size() + 1] = 0;
  for (int i = 1; i <= g[ver].size(); i++) {
    if (pref[i - 1] < deep[g[ver][i - 1]] && g[ver][i - 1] != p) {
      pref[i] = deep[g[ver][i - 1]];
      posPref[i] = num[g[ver][i - 1]];
    } else {
      pref[i] = pref[i - 1];
      posPref[i] = posPref[i - 1];
    }
  }
  for (int i = g[ver].size(); i >= 1; i--) {
    if (suf[i + 1] < deep[g[ver][i - 1]] && g[ver][i - 1] != p) {
      suf[i] = deep[g[ver][i - 1]];
      posSuf[i] = num[g[ver][i - 1]];
    } else {
      suf[i] = suf[i + 1];
      posSuf[i] = posSuf[i + 1];
    }
  }
  set<pair<int, int> > s;
  for (int i = 0; i < g[ver].size(); i++) {
    int to = g[ver][i];
    if (to != p) {
      s.insert({deep[to], num[to]});
      if (s.size() == 3) {
        s.erase(s.begin());
      }
    }
  }
  if (s.size() == 1) {
    dp2[ver] = (*s.begin()).first;
    dp2Ans[ver].first = (*s.begin()).second;
    dp2Ans[ver].second = pre[dp2Ans[ver].first];
  }
  if (s.size() == 2) {
    dp2[ver] = (*s.begin()).first;
    dp2Ans[ver].first = (*s.begin()).second;
    set<pair<int, int> >::iterator qq = s.begin();
    qq++;
    dp2[ver] += (qq->first);
    dp2Ans[ver].second = (qq->second);
  }
  for (int i = 0; i < g[ver].size(); i++) {
    int to = g[ver][i];
    if (to != p) {
      dfs(to, ver);
    }
  }
  for (int i = 0; i < g[ver].size(); i++) {
    int to = g[ver][i];
    if (to != p) {
      if (dp2[to] + 1 > dp2[ver]) {
        dp2[ver] = dp2[to] + 1;
        dp2Ans[ver] = dp2Ans[to];
      }
    }
  }
  if (dp2[ver] != 0 && s.size() != 1) {
    if (dp2Ans[ver].second != ver) {
      dp[ver] = dp2[ver];
      ans[ver].second = dp2Ans[ver];
      ans[ver].first = ver;
    }
  }
  for (int i = 0; i < g[ver].size(); i++) {
    int to = g[ver][i];
    if (to != p) {
      if ((g[ver].size() > 2 || (g[ver].size() > 1 && p == -1)) &&
          dp2[to] != 0 && dp[ver] < dp2[to] + max(pref[i], suf[i + 2]) + 1) {
        dp[ver] = dp2[to] + max(pref[i], suf[i + 2]) + 1;
        ans[ver].first = dp2Ans[to].first;
        ans[ver].second.first = dp2Ans[to].second;
        if (pref[i] > suf[i + 2]) {
          ans[ver].second.second = posPref[i];
        } else {
          ans[ver].second.second = posSuf[i + 2];
        }
      }
      if (dp[ver] < dp2[to] + 1 && dp2[to] > 0) {
        dp[ver] = dp2[to] + 1;
        ans[ver].first = dp2Ans[to].first;
        ans[ver].second.first = dp2Ans[to].second;
        ans[ver].second.second = ver;
      }
      if (dp[ver] < dp[to]) {
        dp[ver] = dp[to];
        ans[ver].first = ans[to].first;
        ans[ver].second = ans[to].second;
      }
    }
  }
  s.clear();
  for (int i = 0; i < g[ver].size(); i++) {
    int to = g[ver][i];
    if (to != p) {
      s.insert({deep[to], num[to]});
      if (s.size() == 4) {
        s.erase(s.begin());
      }
    }
  }
  if (s.size() == 2) {
    set<pair<int, int> >::iterator qq = s.begin();
    int sum = qq->first;
    w.first = qq->second;
    qq++;
    sum += qq->first;
    w.second.first = qq->second;
    w.second.second = ver;
    if (sum > dp[ver]) {
      dp[ver] = sum;
      ans[ver] = w;
    }
  }
  if (s.size() == 3) {
    set<pair<int, int> >::iterator qq = s.begin();
    int sum = qq->first;
    w.first = qq->second;
    qq++;
    sum += qq->first;
    w.second.first = qq->second;
    qq++;
    w.second.second = qq->second;
    sum += qq->first;
    if (sum > dp[ver]) {
      dp[ver] = sum;
      ans[ver] = w;
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> f >> f1;
    g[f].push_back(f1);
    g[f1].push_back(f);
  }
  build(1);
  dfs(1);
  cout << dp[1] << endl;
  cout << ans[1].first << " " << ans[1].second.first << " "
       << ans[1].second.second << endl;
}