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 JAVA):

Solution:


import java.util.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;
import java.math.*;
import java.text.DecimalFormat;
public class Prac{     
    static class InputReader { 
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        public InputReader(InputStream st) {
            this.stream = st;
        } 
        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } 
                catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        } 
        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
            c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        } 
        public int[] nia(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        } 
        public String rs() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                    c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        } 
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        } 
    }
    static PrintWriter w = new PrintWriter(System.out);
    static long mod=998244353L,mod1=1000000007;
    public static class Key {
 
    private final int x;
    private final int y;
 
    public Key(int x, int y) {
        this.x = x;
        this.y = y;
    }
 
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Key)) return false;
        Key key = (Key) o;
        return x == key.x && y == key.y;
    }
 
    @Override
    public int hashCode() {
        int result = x;
        result = 31 * result + y;
        return result;
    }
 
}
    static ArrayList<Integer> arr[];
    static int maxh[][],root=-1,max=-1,maxV=-1,node=-1;
//    static int dfs(int root,int p){
//        ArrayList<Integer> h=new ArrayList<>();
//        int max=-1;
//        for(int j:arr[root]){
//            if(arr[root].size()==1&&root!=p){
//                maxh[root][0]=root;
//            }
//            if(j!=p){
//                int hei=dfs(j,root);
//                if((hei)>max){
//                    max=hei;
//                    maxh[root][0]=maxh[j][0];
//                    maxh[root][1]=max;
//                }
//                h.add(hei);
//            }
//        }
//        if(h.size()==1){
//            Collections.sort(h);
//           maxh[root][0]=1+h.get(0);
//           return 1+h.get(0);
//        }
//        else if(h.size()>1){
//            Collections.sort(h);
//            maxh[root][0]=1+h.get(h.size()-1);
//            maxh[root][1]=1+h.get(h.size()-2);
//            return 1+h.get(h.size()-1);
//        }
//        return 1+maxh[root][1];
//    }
    static Deque<Integer> deq;
    static boolean dfs1(int i,int p){
        if(i==max)return true;
        for(int j:arr[i]){
            if(j!=p){
                deq.addLast(j);
                boolean f=dfs1(j,i);
                if(!f){
                    deq.pollLast();
                }
                else return true;
                
            }
        }
        return false;
    }
    public static void main (String[] args)throws IOException{
        InputReader sc=new InputReader(System.in);
        int n=sc.ni();
        arr=new ArrayList[n+1];
        maxh=new int[n+1][2];
        deq=new LinkedList<>();
        for(int i=0;i<=n;i++)arr[i]=new ArrayList<>();
        for(int i=0;i<n-1;i++){
            int u=sc.ni();
            int v=sc.ni();
            arr[u].add(v);
            arr[v].add(u);
        }
   
//        for(int i=1;i<=n;i++){
//            if(arr[i].size()==1){
//                root=i;
//                break;
//            }
//        }
        Queue<Integer> q1=new LinkedList<>();
  
        boolean v[]=new boolean[n+1];
        q1.add(1);
        while(!q1.isEmpty()){
            int size=q1.size();
            while(size-->0){
                int x=q1.poll();
                v[x]=true;
                root=x;
                for(int j:arr[x]){
                    if(!v[j])q1.add(j);
                }
            }
        }




        Queue<Integer> q=new LinkedList<>();
  
        //boolean v[]=new boolean[n+1];
        Arrays.fill(v,false);
        q.add(root);
        while(!q.isEmpty()){
            int size=q.size();
            while(size-->0){
                int x=q.poll();
                v[x]=true;
                max=x;
                for(int j:arr[x]){
                    if(!v[j])q.add(j);
                }
            }
        }
       
        //dfs(root,root);
        deq.add(root);
        dfs1(root,root);
        int ans=deq.size()-1;
        maxV=0;node=-1;
        Arrays.fill(v,false);
        while(deq.size()>=2){
            int ro=deq.pollFirst();
            int igno=deq.peekFirst();
            Queue<Integer> qu=new LinkedList<>();
            qu.add(ro);
            int l=-1,ele=-1;
            while(!qu.isEmpty()){
                int si=qu.size();
               
                
                l++;
                while(si-->0){
                    int x=qu.poll();
                    v[x]=true;
                    ele=x;
                    for(int j:arr[x]){
                        if(!v[j]&&j!=igno)qu.add(j);
                    }
                }
                
            }
            if(l>maxV){
                maxV=l;
                node=ele;
            }
        }
        ans+=maxV;
        w.println(ans);
        if(node==-1){
            for(int i=1;i<=n;i++){
                if(i!=root&&i!=max){
                    node=i;
                    break;
                }
            }
        }
        w.println(root+" "+max+" "+node);
        w.close();
    }
}