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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;

public class P1294F2 {

	private static int n;
	private static HashMap<Integer, ArrayList<Integer>> g;
	private static int[][] dp;
	private static int[][] dp2;
	private static ArrayList<Integer> sol;
	
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		n = in.nextInt();
		g = new HashMap<>();
		for(int i=0; i<n; i++) {
			g.put(i, new ArrayList<>());
		}
		for(int i=0; i<n-1; i++) {
			int p = in.nextInt()-1;
			int q = in.nextInt()-1;
			g.get(p).add(q);
			g.get(q).add(p);
		}
		dp2 = new int[n][4];
		for(int i=0; i<n; i++) {
			Arrays.fill(dp2[i], -1);
		}
		
		dp = new int[n][4];
		for(int i=0; i<n; i++) Arrays.fill(dp[i], -1);
		//dp[u][left] --> max number of edges in subtree rooted at u that 
		//		can be part of answer
		dfs(0, -1, 3);
		
		System.out.println(dp[0][3]);
		
		sol = new ArrayList<>();
		
		trace(0, -1, 3);
		
		for(int x: sol) {
			w.write((x+1)+" ");
		}
		w.write("\n");
		w.close();
	
	}
	
	
	private static void trace(int u, int p, int left) {
		
		for(int v: g.get(u)) {
			if (v==p) continue;
			
			for(int j=0; j<=left; j++) {
				dfs(v, u, j);
			}
			
		}
		
		int ans = -1*(int)1e9;
		
		//not select u
		dfs(u, p, left);

//		System.out.println("P2");
		
		int x = select(0, left, u, p);
		int y = select(0, left-1, u, p);
//		System.out.println("P3");
		
		if (dp[u][left]==select(0, left, u, p)) {
			int childIndex = 0;
			int left2 = left;
			
			while(left2>0) {
//				System.out.println("P4");
				int child = g.get(u).get(childIndex);
				if (child==p) {
					childIndex++;
					continue;
				}
				for(int j=0; j<=left2; j++) {
					if (select(childIndex, left2, u, p)==((j==1 || j==2?1:0)+dp[child][j]+select(childIndex+1, left2-j, u, p))) {
						left2-=j;
						childIndex++;
						trace(child, u, j);
						break;
					}
				}
				
			}
		} else {
			int childIndex = 0;
			int left2 = left-1;
			sol.add(u);
			
			while(left2>0) {
//				System.out.println(sol.size());
				int child = g.get(u).get(childIndex);
				if (child==p) {
					childIndex++;
					continue;
				}
				for(int j=0; j<=left2; j++) {
					if (select(childIndex, left2, u, p)==((j==1 || j==2?1:0)+dp[child][j]+select(childIndex+1, left2-j, u, p))) {
						left2-=j;
						childIndex++;
						trace(child, u, j);
						break;
					}
				}
				
			}
		}
	}
	
	private static int select(int childIndex, int left, int u, int p) {
		if (left<=0) {
			return 0;
		}
		if (childIndex==g.get(u).size()) return -1*(int)1e9;
		
		int ans = -1*(int)1e9;

		int child = g.get(u).get(childIndex);
		
		if (child==p) {
			return select(childIndex+1, left, u, p);
		}
		
		if (dp2[child][left]!=-1) {
			return dp2[child][left];
		}
		
		for(int j=0; j<=left; j++) {
			ans = Math.max(ans, (j==1 || j==2?1:0)+dp[child][j]+select(childIndex+1, left-j, u, p));
		}
		
		return dp2[child][left]=ans;
	}
	
	private static void dfs(int u, int p, int left) {
		
		ArrayList<Integer> children = new ArrayList<>();
		
		if (dp[u][left]!=-1) return;
		
		for(int v: g.get(u)) {
			if (v==p) continue;
			
			for(int j=0; j<=left; j++) {
				dfs(v, u, j);
			}
			
			children.add(v);
			
		}
		int ans = -1*(int)1e9;
		
		//not select u
		ans = Math.max(ans, select(0, left, u, p));
		ans = Math.max(ans, select(0, left-1, u, p));
		
		dp[u][left] = ans;
		
	}
	
	
	
	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 nextInt() {
			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 nextLong() {
			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[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
 
		public String readString() {
			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;
		}
 
	}
	
	
	
	
	
	
	
	
	
	
	
	
//	private static void dfs(int u, int p, int left) {
//		
//		ArrayList<int[]> oneList = new ArrayList<>();
//		
//		int child = 0;
//		ArrayList<Integer> children = new ArrayList<>();
//		
//		for(int v: g.get(u)) {
//			if (v==p) continue;
//			
//			child++;
//			dfs(v, u, 1);
//			children.add(v);
//			
//			
//			oneList.add(new int[] {v, dp[v][1]});
//		}
//		
//		
//		ArrayList<int[]> twoList = new ArrayList<>();
//		
//		for(int v: g.get(u)) {
//			if (v==p) continue;
//			
//			dfs(v, u, 2);
//			
//			twoList.add(new int[]{v, dp[v][2]});
//		}
//		
//			
//		ArrayList<int[]> threeList = new ArrayList<>();
//		
//		for(int v: g.get(u)) {
//			if (v==p) continue;
//			
//			dfs(v, u, 3);
//			
//			threeList.add(new int[] {v, dp[v][3]});
//		}
//		
//		int ans = -1*(int)1e9;
//		
//		//not select u
//		ans = Math.max(ans, select(0, left, children));
//		ans = Math.max(ans, select(0, left-1, children));
//		
//		dp[u][left] = ans;
//			
////		int ans = 0;
////		
////		//not select u node
////		
////		if (left==3) {
////			if (oneList.size()>=3) {
////				int cs = 0;
////				for(int j=oneList.size()-1; j>=oneList.size()-3; j--) {
////					cs += oneList.get(j);
////				}
////				ans = Math.max(ans, 3+cs);
////			}
////			if (twoList.size()>=1 && oneList.size()>=1) {
////				ans = Math.max(ans, 2+twoList.get(twoList.size()-1)+oneList.get(oneList.size()-1));
////			}
////			if (threeList.size()>=1) {
////				ans = Math.max(ans, threeList.get(threeList.size()-1));
////			}
////		} else if (left==2) {
////			if (twoList.size()>=1) {
////				ans = Math.max(ans, 1+twoList.get(twoList.size()-1));
////			}
////			if (oneList.size()>=2) {
////				int cs = 0;
////				for(int j=oneList.size()-1; j>=oneList.size()-2; j--) {
////					cs += oneList.get(j);
////				}
////				ans = Math.max(ans, 2+cs);
////			}
////		} else if (left==1){
////			if (oneList.size()>=1) {
////				ans = Math.max(ans, 1+oneList.get(oneList.size()-1));
////			}
////		} else {
////			
////		}
////		
////		
////		//select u node
////		
////		left--;
////		
////		if (left==2) {
////			if (twoList.size()>=1) {
////				ans = Math.max(ans, 1+twoList.get(twoList.size()-1));
////			}
////			if (oneList.size()>=2) {
////				int cs = 0;
////				for(int j=oneList.size()-1; j>=oneList.size()-2; j--) {
////					cs += oneList.get(j);
////				}
////				ans = Math.max(ans, 2+cs);
////			}
////		} else if (left==1){
////			if (oneList.size()>=1) {
////				ans = Math.max(ans, 1+oneList.get(oneList.size()-1));
////			}
////		} else {
////			
////		}
////		
////		dp[u][left+1] = ans;
//		
//	}
	
	

}