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.io.*;
import java.math.BigInteger;
import java.util.*;


public class Main {

	 static class FastReader 
	    { 
	        final private int BUFFER_SIZE = 1 << 16; 
	        private DataInputStream din; 
	        private byte[] buffer; 
	        private int bufferPointer, bytesRead; 
	  
	        public FastReader() 
	        { 
	            din = new DataInputStream(System.in); 
	            buffer = new byte[BUFFER_SIZE]; 
	            bufferPointer = bytesRead = 0; 
	        } 
	  
	        public FastReader(String file_name) throws IOException 
	        { 
	            din = new DataInputStream(new FileInputStream(file_name)); 
	            buffer = new byte[BUFFER_SIZE]; 
	            bufferPointer = bytesRead = 0; 
	        } 
	  
	        public String readLine() throws IOException 
	        { 
	            byte[] buf = new byte[64]; // line length 
	            int cnt = 0, c; 
	            while ((c = read()) != -1) 
	            { 
	                if (c == '\n') 
	                    break; 
	                buf[cnt++] = (byte) c; 
	            } 
	            return new String(buf, 0, cnt); 
	        } 
	  
	        public int nextInt() throws IOException 
	        { 
	            int ret = 0; 
	            byte c = read(); 
	            while (c <= ' ') 
	                c = read(); 
	            boolean neg = (c == '-'); 
	            if (neg) 
	                c = read(); 
	            do
	            { 
	                ret = ret * 10 + c - '0'; 
	            }  while ((c = read()) >= '0' && c <= '9'); 
	  
	            if (neg) 
	                return -ret; 
	            return ret; 
	        } 
	  
	        public long nextLong() throws IOException 
	        { 
	            long ret = 0; 
	            byte c = read(); 
	            while (c <= ' ') 
	                c = read(); 
	            boolean neg = (c == '-'); 
	            if (neg) 
	                c = read(); 
	            do { 
	                ret = ret * 10 + c - '0'; 
	            } 
	            while ((c = read()) >= '0' && c <= '9'); 
	            if (neg) 
	                return -ret; 
	            return ret; 
	        } 
	  
	        public double nextDouble() throws IOException 
	        { 
	            double ret = 0, div = 1; 
	            byte c = read(); 
	            while (c <= ' ') 
	                c = read(); 
	            boolean neg = (c == '-'); 
	            if (neg) 
	                c = read(); 
	  
	            do { 
	                ret = ret * 10 + c - '0'; 
	            } 
	            while ((c = read()) >= '0' && c <= '9'); 
	  
	            if (c == '.') 
	            { 
	                while ((c = read()) >= '0' && c <= '9') 
	                { 
	                    ret += (c - '0') / (div *= 10); 
	                } 
	            } 
	  
	            if (neg) 
	                return -ret; 
	            return ret; 
	        } 
	  
	        private void fillBuffer() throws IOException 
	        { 
	            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
	            if (bytesRead == -1) 
	                buffer[0] = -1; 
	        } 
	  
	        private byte read() throws IOException 
	        { 
	            if (bufferPointer == bytesRead) 
	                fillBuffer(); 
	            return buffer[bufferPointer++]; 
	        } 
	  
	        public void close() throws IOException 
	        { 
	            if (din == null) 
	                return; 
	            din.close(); 
	        } 
	    } 
	
		public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
		public static long mod = (long) (1e9 + 7);
		public static int N = (int) 1e5;
		public static long[][] dp;
	    public static List<Integer>[] edges ;
		public static int[][] parent;
		public static int col = 20;
		public static int[] level;
		
		public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		parent = new int[n+1][col];
		edges = new ArrayList[n+1];
		for(int i=0;i<=n;++i) {
			edges[i] = new ArrayList<>();
			Arrays.fill(parent[i],-1);
		}
		
		for(int i=1;i<n;++i) {
			int u = sc.nextInt();
			int v = sc.nextInt();
			edges[u].add(v);
			edges[v].add(u);
		}
		level = new int[n+1];
		dfs(1,0);
		// LCA preprocess
		for(int j=1;j<col;++j) {
			for(int i=1;i<=n;++i) {
				if(parent[i][j-1] != -1)
				parent[i][j] = parent[parent[i][j-1]][j-1];
			}
		}
		
		
		int a = farthest(1);
		int b = farthest(a);
		int c=-1,max=-1;
		for(int v=1;v<=n;++v) {
			if(v == a || v == b) continue;
			int pathLen = dis(a,v) + dis(b,v);
			if(pathLen > max) {
				max = pathLen;
				c = v;
			}
			
		}
		
		int totalNode = (dis(a,b) + dis(b,c) + dis(c,a))/2;
		out.println(totalNode);
		out.println(a+" "+b+" "+c);
		

		out.close();
	}
	private static int dis(int u, int v) {
			int lca = LCA(u,v);
			return level[u] + level[v] - 2*level[lca];
		}
	
	private static int farthest(int v) {
			int n = edges.length-1;
			int[] d = new int[n+1];
			Arrays.fill(d, -1);
			
			Queue<Integer> q = new ArrayDeque<>();
			q.add(v); d[v] = 0;
			while(q.size() > 0) {
				v = q.poll();
				for(int child : edges[v]) {
					if(d[child] == -1) {
						d[child] = d[v] + 1;
						q.add(child);
					}
				}
			}
			
			int max = 0;
			v = -1;
			for(int i=1;i<=n;++i) {
				if(d[i] > max) {
					max = d[i];
					v = i;
				}
			}
			
			return v;
		}
	
	private static int LCA(int u, int v) {
		if(level[u] < level[v]) {
			u = u^v;
			v = u^v;
			u = u^v;
		}
		// now v is above u
		int diff = level[u] - level[v]; //  MOVING TO THE SAME LEVEL
		for(int i=0;i<col;++i) {
			if(((diff>>i)&1) == 1) {
				u = parent[u][i]; // move to its 2ei parent above
			}
		}
		
		if(u == v) return u; // case when one of them is LCA itself
		
		for(int i=col-1;i>=0;--i) {
			// move upward till their parent are not equal
			if(parent[u][i] != parent[v][i]) {
				u = parent[u][i];
				v = parent[v][i];
			}
		}
		// finally you reach the point where your direct parent is LCA
		return parent[u][0];
	}
	private static void dfs(int v, int par) {
		level[v]=level[par]+1;
		 parent[v][0] = par;
		 for(int child : edges[v]) {
			 if(child != par) {
				 dfs(child,v);
			 }
		 }
		
	}

}