output_description: For the lexicographically smallest (A,B), print A and B with a space in
  between.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 b_1
      :
      a_{N-1} b_{N-1}
attempt: from collections import defaultdict
  import sys
  from math import log2
  
  sys.setrecursionlimit(10**6)
  input = sys.stdin.readline
  int1 = lambda x: int(x) - 1
  p2D = lambda x: print(*x, sep="\n")
  
  
  def main():
      def init(i, oi=-1, dpt=0):
          depth[i] = dpt
          parent_2k[0][i] = oi
          for ki in to[i]:
              if ki == oi:
                  continue
              init(ki, i, dpt + 1)
          return
  
      def make_parent(level):
          parent_2kk1 = parent_2k[0]
          for k in range(1, level):
              parent_2kk = parent_2k[k]
              for i in range(n):
                  parent1 = parent_2kk1[i]
                  if parent1 != -1:
                      parent_2kk[i] = parent_2kk1[parent1]
              parent_2kk1 = parent_2kk
          return
  
      def lca(u, v):
          dist_uv = depth[u] - depth[v]
          if dist_uv < 0:
              u, v = v, u
              dist_uv *= -1
  
          k = 0
          while dist_uv:
              if dist_uv & 1:
                  u = parent_2k[k][u]
              dist_uv >>= 1
              k += 1
  
          if u == v:
              return u
  
          for k in range(int(log2(depth[u])) + 1, -1, -1):
              pu = parent_2k[k][u]
              pv = parent_2k[k][v]
              if pu != pv:
                  u = pu
                  v = pv
          return parent_2k[0][u]
  
      def dfs(i, mx, len_odd):
          if i == len_odd:
              return mx
          if fin[i]:
              return dfs(i + 1, mx, len_odd)
          res = inf
          fin[i] = True
          for j in range(i + 1, len_odd):
              if fin[j]:
                  continue
              fin[j] = True
              res = min(res, dfs(i + 1, max(mx, dist[i][j]), len_odd))
              fin[j] = False
          fin[i] = False
          return res
  
      inf = 10**6
      n = int(input())
      to = defaultdict(list)
      for _ in range(n - 1):
          a, b = map(int1, input().split())
          to[a].append(b)
          to[b].append(a)
      depth = [0] * n
      level = int(log2(n)) + 1
      parent_2k = [[-1] * n for _ in range(level)]
      init(0)
      make_parent(level)
  
      odd_degree_nodes = []
      for u in range(n):
          if len(to[u]) % 2:
              odd_degree_nodes.append(u)
      # print(odd_degree_nodes)
      len_odd = len(odd_degree_nodes)
      ans_a = len_odd // 2
  
      dist = [[-1] * len_odd for _ in range(len_odd)]
      for j in range(len_odd):
          v = odd_degree_nodes[j]
          for i in range(j):
              u = odd_degree_nodes[i]
              lca_uv = lca(u, v)
              dist[i][j] = dist[j][i] = depth[u] + depth[v] - 2 * depth[lca_uv]
      # p2D(dist)
  
      fin = [False] * len_odd
      ans_b = dfs(0, 0, len_odd)
      print(ans_a, ans_b)
  
  
  main()
  
problem_description: Statement
  
  Takahashi has decided to make a _Christmas Tree_ for the Christmas party in
  AtCoder, Inc.
  
  A Christmas Tree is a tree with N vertices numbered 1 through N and N-1 edges,
  whose i-th edge (1\leq i\leq N-1) connects Vertex a_i and b_i.
  
  He would like to make one as follows:
  
    * Specify two non-negative integers A and B.
    * Prepare A _Christmas Paths_ whose lengths are at most B. Here, a Christmas Path of length X is a graph with X+1 vertices and X edges such that, if we properly number the vertices 1 through X+1, the i-th edge (1\leq i\leq X) will connect Vertex i and i+1.
    * Repeat the following operation until he has one connected tree:
      * Select two vertices x and y that belong to different connected components. Combine x and y into one vertex. More precisely, for each edge (p,y) incident to the vertex y, add the edge (p,x). Then, delete the vertex y and all the edges incident to y.
    * Properly number the vertices in the tree.
  
  Takahashi would like to find the lexicographically smallest pair (A,B) such
  that he can make a Christmas Tree, that is, find the smallest A, and find the
  smallest B under the condition that A is minimized.
  
  Solve this problem for him.
samples: [{"input": "7\n    1 2\n    2 3\n    2 4\n    4 5\n    4 6\n    6 7", "output": "3 2\n    \n\nWe can make a Christmas Tree as shown in the figure below:\n\n![](https://img.atcoder.jp/arc088/96f78221624d6a13628f6052f5db697d.png)\n\n* * *"}, {"input": "8\n    1 2\n    2 3\n    3 4\n    4 5\n    5 6\n    5 7\n    5 8", "output": "2 5\n    \n\n* * *"}, {"input": "10\n    1 2\n    2 3\n    3 4\n    2 5\n    6 5\n    6 7\n    7 8\n    5 9\n    10 5", "output": "3 4"}]