output_description: Print the number of moves Aoki will perform before the end of the game.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N u v
      A_1 B_1
      :
      A_{N-1} B_{N-1}
attempt: import os
  import sys
  import numpy as np
  
  
  def solve(N, U, V, AB):
      G = [[0] * 0 for _ in range(N + 1)]
      for idx_ab in range(len(AB)):
          a, b = AB[idx_ab]
          G[a].append(b)
          G[b].append(a)
      P1 = np.zeros(N + 1, dtype=np.int64)
  
      def dfs1(u):
          st = [u]
          while st:
              v = st.pop()
              p = P1[v]
              for u in G[v]:
                  if p != u:
                      st.append(u)
                      P1[u] = v
  
      dfs1(U)
      path_u2v = [U]
      v = V
      while v != U:
          v = P1[v]
          path_u2v.append(v)
      path_u2v.reverse()
      l = len(path_u2v)
      half = (l - 2) // 2
      c = path_u2v[half]
      ng = path_u2v[half + 1]
      Depth = np.zeros(N + 1, dtype=np.int64)
  
      def dfs2(c):
          st = [c]
          P = np.zeros(N + 1, dtype=np.int64)
          while st:
              v = st.pop()
              p = P[v]
              d = Depth[v]
              for u in G[v]:
                  if p != u and u != ng:
                      st.append(u)
                      P[u] = v
                      Depth[u] = d + 1
  
      dfs2(c)
      c_ = path_u2v[l - 1 - half]
      v = c_
      while v != c:
          Depth[v] = 0
          v = P1[v]
      d = l % 2
      ans = max(Depth) + half + d
      return ans
  
  
  # >>> numba compile >>>
  numba_config = [
      [solve, "i8(i8,i8,i8,i8[:,:])"],
  ]
  if sys.argv[-1] == "ONLINE_JUDGE":
      from numba import njit
      from numba.pycc import CC
  
      cc = CC("my_module")
      for func, signature in numba_config:
          vars()[func.__name__] = njit(signature)(func)
          cc.export(func.__name__, signature)(func)
      cc.compile()
      exit()
  elif os.name == "posix":
      exec(f"from my_module import {','.join(func.__name__ for func, _ in numba_config)}")
  else:
      from numba import njit
  
      for func, signature in numba_config:
          vars()[func.__name__] = njit(signature, cache=True)(func)
      print("compiled!", file=sys.stderr)
  # <<< numba compile <<<
  
  
  def main():
      N, u, v = map(int, input().split())
      if N == 2:
          print(0)
          return
      AB = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(N - 1, 2)
      ans = solve(N, u, v, AB)
      print(ans)
  
  
  main()
  
problem_description: Statement
  
  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.
samples: [{"input": "5 4 1\n    1 2\n    2 3\n    3 4\n    3 5", "output": "2\n    \n\nIf both players play optimally, the game will progress as follows:\n\n  * Takahashi moves to Vertex 3.\n  * Aoki moves to Vertex 2.\n  * Takahashi moves to Vertex 5.\n  * Aoki moves to Vertex 3.\n  * Takahashi moves to Vertex 3.\n\nHere, Aoki performs two moves.\n\nNote that, in each move, it is prohibited to stay at the current vertex.\n\n* * *"}, {"input": "5 4 5\n    1 2\n    1 3\n    1 4\n    1 5", "output": "1\n    \n\n* * *"}, {"input": "2 1 2\n    1 2", "output": "0\n    \n\n* * *"}, {"input": "9 6 1\n    1 2\n    2 3\n    3 4\n    4 5\n    5 6\n    4 7\n    7 8\n    8 9", "output": "5"}]