We have a tree with N vertices. The i-th edge connects Vertex A_i and B_i bidirectionally.

Takahashi is standing at Vertex u, and Aoki is standing at Vertex v.

Now, they will play a game of tag as follows:

* 1. If Takahashi and Aoki are standing at the same vertex, the game ends. Otherwise, Takahashi moves to a vertex of his choice that is adjacent to his current vertex.

* 2. If Takahashi and Aoki are standing at the same vertex, the game ends. Otherwise, Aoki moves to a vertex of his choice that is adjacent to his current vertex.

* 3. Go back to step 1.




Takahashi performs his moves so that the game ends as late as possible, while Aoki performs his moves so that the game ends as early as possible.

Find the number of moves Aoki will perform before the end of the game if both Takahashi and Aoki know each other's position and strategy.

It can be proved that the game is bound to end.

Constraints

* 2 \leq N \leq 10^5
* 1 \leq u,v \leq N
* u \neq v
* 1 \leq A_i,B_i \leq N
* The given graph is a tree.

Input

Input is given from Standard Input in the following format:


N u v
A_1 B_1
:
A_{N-1} B_{N-1}


Output

Print the number of moves Aoki will perform before the end of the game.

Examples

Input

5 4 1
1 2
2 3
3 4
3 5


Output

2


Input

5 4 5
1 2
1 3
1 4
1 5


Output

1


Input

2 1 2
1 2


Output

0


Input

9 6 1
1 2
2 3
3 4
4 5
5 6
4 7
7 8
8 9


Output

5
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false); 
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}	
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}		    
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}	    	  	
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}		
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}	
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}	    	
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}	    	
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}				
    }
    
    /********* SOLUTION STARTS HERE ************/
    static ArrayList<Integer> ar[];
    static int n;
    static int dep1[],dep2[];
    static boolean vis[];
    private static void solve(FastScanner in, PrintWriter out){
        n = in.nextInt();
        int tak = in.nextInt()-1;
        int aok = in.nextInt()-1;
        int u,v;
        ar = new ArrayList[n];
        dep1 = new int[n];
        dep2 = new int[n];
        vis = new boolean[n];
        for(int i=0;i<n;i++) ar[i] = new ArrayList<Integer>();
        for(int i=0;i<n-1;i++){
            u = in.nextInt()-1;
            v = in.nextInt()-1;
            ar[u].add(v);
            ar[v].add(u);
        }
        dfs1(tak,0);
        Arrays.fill(vis,false);
        dfs2(aok,0);
        int ans = 0;
        for(int i=0;i<n;i++){
            if(dep1[i]<dep2[i]){
                ans = Math.max(ans,dep2[i]);
            }
        }
        out.println(ans-1);
    }
    static void dfs1(int s,int d){
        dep1[s] = d;
        vis[s] = true;
        for(int i:ar[s]){
            if(!vis[i]) dfs1(i,d+1);
        }
    }
    static void dfs2(int s,int d){
        dep2[s] = d;
        vis[s] = true;
        for(int i:ar[s]){
            if(!vis[i]) dfs2(i,d+1);
        }
    }
    /************* SOLUTION ENDS HERE **********/
}