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.
//package math_codet;

import java.io.*;
import java.util.*;
 
public class lets_do {
    FastReader in;
    PrintWriter out;
    Helper_class h;
    final long mod = 1000000009;
    final int MAXN = 1000000;
    final int lgN = 20;
    final long INF = (long)1e16;
    final int MAX_Ai = 1000001;
    public static void main(String[] args) throws java.lang.Exception{
        new lets_do().run();
    }
    void run() throws Exception{
        in=new FastReader(System.in);
        out = new PrintWriter(System.out);
        h = new Helper_class();
        int t = 1;
        while(t-->0)
            solve();
        out.flush();
        out.close();
    }
    ArrayList<Integer>[] tree;
    int n;
    int ans_vertex = 0;
    int[][] anc;
    int[] dist;
    void dfs(int v, int p, int hh){
        dist[v] = hh;
        for(int u : tree[v]) {
            if(u != p)
                dfs(u, v, hh + 1);
        }
    }
    int[] tin, tout;
    int timer = 0;
    void dfs1(int v, int p){
        anc[0][v] = p;
        int i = 0;
        tin[v] = timer++;
        for(i = 1; i < lgN; i++)
            anc[i][v] = anc[i - 1][anc[i - 1][v]];
        for(int u : tree[v]){
            if(u != p)
                dfs1(u, v);
        }
        tout[v] = timer++;
    }
    
    boolean is_ancestor(int u, int v){
        return tin[u] <= tin[v] && tout[u] >= tout[v];
    }

    int lca_of(int u, int v){
        if(is_ancestor(u, v))
            return u;
        if(is_ancestor(v, u))
            return v;
        int i = 0;
        for(i = lgN - 1; i >= 0; i--){
            if(!is_ancestor(anc[i][u], v))
                u = anc[i][u];
        }
        return anc[0][u];
    }
    int mx = 0;
    int ind = -1;
    void dfs2(int v, int x, int y, int p, int hh){
        if(hh > mx){
            mx = hh;
            ind = v;
        }
        for(int u : tree[v]){
            if(u != p && u != x && u != y)
                dfs2(u, x, y, v, hh + 1);
        }
    }

    void solve(){
        n = h.ni();
        
        tree = new ArrayList[n];
        int i = 0;
        anc = new int[lgN][n];
        for(i = 0; i < n; i++)
            tree[i] = new ArrayList<Integer>();
        tin = new int[n];
        tout = new int[n];
        int[] deg = new int[n];
        for(i = 0; i < n - 1; i++){
            int x = h.ni() - 1;
            int y = h.ni() - 1;
            tree[x].add(y);
            tree[y].add(x);
            deg[x]++;
            deg[y]++;
        }
        int cnt = 0;
        for(i = 0; i < n; i++){
            if(deg[i] == 1)
            cnt++;
        }
        if(cnt == 2){
            h.pn(n - 1);
            cnt = 0;
            for(i = 0; i < n; i++){
                if(deg[i] == 1){
                    h.p((i + 1) +" ");
                }
            }
            for(i = 0; i < n; i++){
                if(deg[i] != 1){
                    h.p((i + 1) +" ");
                    break;
                }
            }
            return;
        }
        dist = new int[n];
        dfs(0, -1, 0);
        int y = 0, x = 0;
        mx = 0;
        for(i = 0; i < n; i++) {
            if(dist[i] > mx) {
                x = i;
                mx = dist[i];
            }
        }
        dist = new int[n];
        dfs(x, -1, 0);
        mx = 0;
        for(i = 0; i < n; i++) {
            if(dist[i] > mx) {
                y = i;
                mx = dist[i];
            }
        }
        dfs1(0, 0);
        int lca = lca_of(x, y);
        int ans1 = x;
        int ans2 = y;
        ArrayList<Integer> path = new ArrayList<Integer>();
        while(x != lca){
            path.add(x);
            x = anc[0][x];
        }
        path.add(lca);
        ArrayList<Integer> path1 = new ArrayList<Integer>();
        while(y != lca){
            path1.add(y);
            y = anc[0][y];
        }
        
        for(i = path1.size() - 1; i  >= 0; i--)
            path.add(path1.get(i));
        int ans = mx;
        int max = -1;int ind1 = -1;
        for(i = 1; i < path.size() - 1; i++){
            mx = 0;
            dfs2(path.get(i), path.get(i - 1), path.get(i + 1), -1, 0);
            if(mx > max){
                max = mx;
                ind1 = ind;
            }
        }
        h.pn(max + ans);
        h.pn((ans1 + 1) +" "+(ans2 + 1) +" "+(ind1 + 1));
    }



    static final Comparator<Pair> com = new Comparator<Pair>(){
        public int compare(Pair a, Pair b){
            if(Long.compare(a.x, b.x) != 0)
                return Long.compare(a.x, b.x);
            else
                return Long.compare(a.y, b.y);
        }
    };
    
    class Pair{
        long x;
        long y;
        Pair(long p, long q){
            x = p;
            y = q;
        }
    }
    class Edge{
        int u , v;
        Edge(int a, int b){
            u = a;
            v = b;
        }
        int other(int x) {
            return u ^ v ^ x;
        }
    }
    class Helper_class{
        long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
        int bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}
        void p(Object o){out.print(o);}
        void pn(Object o){out.println(o);}
        void pni(Object o){out.println(o);out.flush();}
        String n(){return in.next();}
        String nln(){return in.nextLine();}
        int ni(){return Integer.parseInt(in.next());}
        long nl(){return Long.parseLong(in.next());}
        double nd(){return Double.parseDouble(in.next());}
 
        long mul(long a,long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            a*=b;
            if(a>=mod)a%=mod;
            return a;
        }
        long modPow(long a, long p){
            long o = 1;
            while(p>0){
                if((p&1)==1)o = mul(o,a);
                a = mul(a,a);
                p>>=1;
            }
            return o;
        }
        long add(long a, long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            if(b<0)b+=mod;
            a+=b;
            if(a>=mod)a-=mod;
            return a;
        }
    }
 
    class FastReader{
        private InputStream stream; 
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
 
        public FastReader(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }
 
        public void skip(int x) {
            while (x-- > 0)
                read();
        }
 
        public int nextInt() {
            return Integer.parseInt(next());
        }
 
        public long nextLong() {
            return Long.parseLong(next());
        }
 
        public String nextString() {
            return next();
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
 
            return res.toString();
        }
 
        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }
 
        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
 
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }
 
        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
} 