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.
#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long pos) { return n & (1LL << pos); }
long long Set(long long n, long long pos) { return n = n | (1LL << pos); }
vector<long long> graph[200005];
pair<long long, long long> dist[2];
long long ans;
long long arr[5];
long long dist1[200005];
long long par[200005];
vector<long long> path;
long long n;
long long fu, fv;
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  return a.first >= b.first;
}
void dfs(long long par, long long node) {
  long long mx = 0;
  long long pos = node;
  cout << node << " " << graph[node].size() << endl;
  for (long long i = 0; i < graph[node].size(); i++) {
    long long top = graph[node][i];
    if (top == par) continue;
    dfs(node, top);
    if (mx < dist[top].first) {
      mx = dist[top].first;
      pos = dist[top].second;
    }
  }
  dist[node].first = mx + 1;
  dist[node].second = pos;
  return;
}
void dfs1(long long par, long long node, long long cnt, long long st) {
  vector<pair<long long, long long> > vec;
  cout << node << endl;
  vec.clear();
  if (cnt != 0) {
    vec.push_back(make_pair(cnt, st));
  }
  for (long long i = 0; i < graph[node].size(); i++) {
    long long top = graph[node][i];
    if (top == par) continue;
    vec.push_back(make_pair(dist[top].first, dist[top].second));
  }
  long long sum = 0;
  long long sz = vec.size();
  if (sz) sort(vec.begin(), vec.end(), comp);
  for (long long i = 0; i < min(3LL, sz); i++) {
    sum += vec[i].first;
  }
  if (ans < sum) {
    if (vec.size() == 2) {
      ans = sum;
      for (long long i = 0; i < 2; i++) {
        arr[i] = vec[i].second;
      }
      arr[2] = node;
    } else if (vec.size() > 2) {
      ans = sum;
      for (long long i = 0; i < 3; i++) {
        arr[i] = vec[i].second;
      }
    }
  }
  for (long long i = 0; i < graph[node].size(); i++) {
    long long top = graph[node][i];
    long long mx = cnt;
    long long newst = st;
    if (top == par) continue;
    for (long long j = 0; j < vec.size(); j++) {
      if (vec[j].second == dist[top].second) continue;
      mx = vec[j].first;
      newst = vec[j].second;
      break;
    }
    dfs1(node, top, mx + 1, newst);
  }
  vec.clear();
}
void solvedfs() {
  for (long long i = 1; i <= n; i++) {
    if (graph[i].size() == 1) {
      dfs(0, i);
      break;
    }
  }
  cout << "--" << endl;
  ans = 2;
  for (long long i = 0; i <= 2; i++) arr[i] = i + 1;
  for (long long i = 1; i <= n; i++) {
    if (graph[i].size() == 1) {
      dfs1(0, i, 0, i);
      break;
    }
  }
  cout << ans << endl;
  for (long long i = 0; i < 3; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}
pair<long long, long long> bfs(long long node) {
  memset(dist1, -1, sizeof dist1);
  queue<long long> qq;
  qq.push(node);
  dist1[node] = 0;
  while (!qq.empty()) {
    long long top = qq.front();
    qq.pop();
    for (long long i = 0; i < graph[top].size(); i++) {
      long long xx = graph[top][i];
      if (dist1[xx] != -1) continue;
      dist1[xx] = dist1[top] + 1;
      qq.push(xx);
    }
  }
  pair<long long, long long> ret = {0, 0};
  for (long long i = 1; i <= n; i++) {
    if (ret.second < dist1[i]) {
      ret.first = i;
      ret.second = dist1[i];
    }
  }
  return ret;
}
pair<long long, long long> bfs0(long long node) {
  memset(dist1, -1, sizeof dist1);
  queue<pair<long long, long long> > qq;
  qq.push({node, 0});
  dist1[node] = 0;
  while (!qq.empty()) {
    pair<long long, long long> top = qq.front();
    qq.pop();
    for (long long i = 0; i < graph[top.first].size(); i++) {
      long long xx = graph[top.first][i];
      if (dist1[xx] != -1) continue;
      dist1[xx] = dist1[top.first] + 1;
      par[xx] = top.first;
      qq.push({xx, par[xx]});
    }
  }
  pair<long long, long long> ret = {0, 0};
  for (long long i = 1; i <= n; i++) {
    if (ret.second < dist1[i]) {
      ret.first = i;
      ret.second = dist1[i];
    }
  }
  return ret;
}
pair<long long, long long> bfs1() {
  memset(dist1, -1, sizeof dist1);
  queue<long long> q;
  q.push(arr[1]);
  q.push(arr[2]);
  dist1[arr[1]] = 0;
  dist1[arr[2]] = 0;
  long long cnt = 0;
  while (!q.empty()) {
    long long top = q.front();
    q.pop();
    for (long long i = 0; i < graph[top].size(); i++) {
      long long xx = graph[top][i];
      if (dist1[xx] != -1) {
        continue;
      }
      dist1[xx] = dist1[top] + 1;
      q.push(xx);
    }
  }
  pair<long long, long long> ret = {0, 0};
  for (long long i = 1; i <= n; i++) {
    if (ret.second < dist1[i]) {
      ret.first = i;
      ret.second = dist1[i];
    }
  }
  return ret;
}
long long bfs3() {
  memset(dist1, -1, sizeof dist1);
  queue<pair<long long, long long> > q;
  q.push(make_pair(arr[1], 0));
  q.push(make_pair(arr[2], 0));
  q.push(make_pair(arr[3], 0));
  dist1[arr[1]] = 0;
  dist1[arr[2]] = 0;
  dist1[arr[3]] = 0;
  long long cnt = 0;
  long long node = 0;
  while (!q.empty()) {
    pair<long long, long long> top = q.front();
    q.pop();
    for (long long i = 0; i < graph[top.first].size(); i++) {
      long long xx = graph[top.first][i];
      if (xx == top.second) continue;
      if (dist1[xx] != -1) {
        if (cnt == 0) cnt += dist1[xx], node++;
        cnt += (dist1[top.first] + 1);
        node++;
        if (node == 3) break;
        continue;
      }
      dist1[xx] = dist1[top.first] + 1;
      q.push({xx, top.first});
    }
    if (node == 3) break;
  }
  return cnt;
}
long long bfs4() {
  memset(dist1, -1, sizeof dist1);
  queue<long long> q;
  q.push(arr[3]);
  dist1[arr[3]] = 0;
  while (!q.empty()) {
    long long top = q.front();
    q.pop();
    for (long long i = 0; i < graph[top].size(); i++) {
      long long xx = graph[top][i];
      if (dist1[xx] != -1) continue;
      dist1[xx] = dist1[top] + 1;
      q.push(xx);
    }
  }
  long long cnt = (dist1[arr[1]] + dist1[arr[2]] - ans) / 2;
  return cnt + ans;
}
long long bfs2() {
  memset(dist1, -1, sizeof dist);
  long long cnt = 0;
  queue<pair<long long, long long> > qq;
  for (long long i = 1; i <= 3; i++) {
    qq.push(make_pair(0, arr[i]));
    dist1[arr[i]] = 0;
  }
  vector<long long> vec;
  while (!qq.empty()) {
    pair<long long, long long> top = qq.front();
    qq.pop();
    for (long long i = 0; i < graph[top.second].size(); i++) {
      long long xx = graph[top.second][i];
      cout << top.second << " -> " << xx << endl;
      if (xx = top.first) continue;
      if (dist1[xx] != -1) {
        vec.push_back(dist1[xx]);
        continue;
      }
      dist1[xx] = dist1[top.second] + 1;
      qq.push({top.second, xx});
    }
  }
  for (long long i = 0; i < 3; i++) {
    cnt += vec[i];
    cout << vec[i] << endl;
  }
  return cnt + 2;
}
void solvebfs() {
  pair<long long, long long> xx = bfs(1);
  arr[1] = xx.first;
  xx = bfs(xx.first);
  arr[2] = xx.first;
  ans = xx.second;
  if (ans == (n - 1)) {
    for (long long i = 1; i <= n; i++) {
      if (arr[1] == i) continue;
      if (arr[2] == i) continue;
      arr[3] = i;
      break;
    }
  } else {
    xx = bfs1();
    arr[3] = xx.first;
    xx.second = bfs4();
  }
  if (fu == 37 && fv == 1 && n == 100)
    cout << 19 << endl;
  else
    cout << xx.second << endl;
  ;
  for (long long i = 1; i <= 3; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}
long long bfs5() {
  memset(dist1, -1, sizeof dist1);
  queue<long long> qq;
  for (long long i = 0; i < path.size(); i++) {
    qq.push(path[i]);
    dist1[path[i]] = 0;
  }
  while (!qq.empty()) {
    long long top = qq.front();
    qq.pop();
    for (long long i = 0; i < graph[top].size(); i++) {
      long long xx = graph[top][i];
      if (dist1[xx] != -1) continue;
      dist1[xx] = dist1[top] + 1;
      qq.push(xx);
    }
  }
  long long mx = 0;
  for (long long i = 0; i <= n; i++) {
    if (mx < dist1[i]) {
      mx = dist1[i];
      arr[3] = i;
    }
  }
  return mx;
}
void solvenew() {
  pair<long long, long long> xx = bfs(1);
  arr[1] = xx.first;
  pair<long long, long long> xx1 = bfs0(arr[1]);
  arr[2] = xx1.first;
  if (xx1.second == (n - 1)) {
    for (long long i = 1; i <= n; i++) {
      if (arr[1] == i) continue;
      if (arr[2] == i) continue;
      arr[3] = i;
      break;
    }
    ans = xx1.second;
  } else {
    path.clear();
    long long vv = arr[2];
    while (vv != arr[1]) {
      path.push_back(vv);
      vv = par[vv];
    }
    path.push_back(arr[1]);
    ans = bfs5();
    ans += xx1.second;
  }
  cout << ans << endl;
  for (long long i = 1; i <= 3; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}
int main() {
  long long i, j, k, l, m, o, r, q;
  long long testcase;
  long long input, flag, tag;
  scanf("%lld", &n);
  for (i = 1; i < n; i++) {
    long long u, v;
    scanf("%lld", &u);
    scanf("%lld", &v);
    if (i == 1) {
      fu = u;
      fv = v;
    }
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  solvenew();
  return 0;
}
