output_description: Print the minimum k such that the given tree is a tree of uninity k.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N
      a_1 b_1
      :
      a_{N-1} b_{N-1}
attempt: import sys
  
  read = sys.stdin.buffer.read
  readline = sys.stdin.buffer.readline
  readlines = sys.stdin.buffer.readlines
  
  N = int(readline())
  m = map(int, read().split())
  AB = zip(m, m)
  
  graph = [[] for _ in range(N + 1)]
  for a, b in AB:
      graph[a].append(b)
      graph[b].append(a)
  
  graph
  
  root = 1
  parent = [0] * (N + 1)
  order = []
  stack = [root]
  while stack:
      x = stack.pop()
      order.append(x)
      for y in graph[x]:
          if y == parent[x]:
              continue
          parent[y] = x
          stack.append(y)
  
  uninity = [0] * (N + 1)
  dp = [(1 << 60) - 1] * (N + 1)  # 使用可能なbitの集合
  for x in order[::-1]:
      p = parent[x]
      # 使用可能なmin
      lsb = dp[x] & (-dp[x])
      uninity[x] = lsb
      dp[x] ^= lsb
      dp[x] |= lsb - 1
      dp[p] &= dp[x]
  
  x = max(uninity).bit_length() - 1
  print(x)
  
problem_description: Statement
  
  We will recursively define _uninity_ of a tree, as follows: (_Uni_ is a
  Japanese word for sea urchins.)
  
    * A tree consisting of one vertex is a tree of uninity 0.
    * Suppose there are zero or more trees of uninity k, and a vertex v. If a vertex is selected from each tree of uninity k and connected to v with an edge, the resulting tree is a tree of uninity k+1.
  
  It can be shown that a tree of uninity k is also a tree of uninity
  k+1,k+2,..., and so forth.
  
  You are given a tree consisting of N vertices. The vertices of the tree are
  numbered 1 through N, and the i-th of the N-1 edges connects vertices a_i and
  b_i.
  
  Find the minimum k such that the given tree is a tree of uninity k.
samples: [{"input": "7\n    1 2\n    2 3\n    2 4\n    4 6\n    6 7\n    7 5", "output": "2\n    \n\nA tree of uninity 1 consisting of vertices 1, 2, 3 and 4 can be constructed\nfrom the following: a tree of uninity 0 consisting of vertex 1, a tree of\nuninity 0 consisting of vertex 3, a tree of uninity 0 consisting of vertex 4,\nand vertex 2.\n\nA tree of uninity 1 consisting of vertices 5 and 7 can be constructed from the\nfollowing: a tree of uninity 1 consisting of vertex 5, and vertex 7.\n\nA tree of uninity 2 consisting of vertices 1, 2, 3, 4, 5, 6 and 7 can be\nconstructed from the following: a tree of uninity 1 consisting of vertex 1, 2,\n3 and 4, a tree of uninity 1 consisting of vertex 5 and 7, and vertex 6.\n\n* * *"}, {"input": "12\n    1 2\n    2 3\n    2 4\n    4 5\n    5 6\n    6 7\n    7 8\n    5 9\n    9 10\n    10 11\n    11 12", "output": "3"}]