N = int(input()) G = [set() for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) a -= 1; b -= 1 G[a].add(b); G[b].add(a) H, S = [0]*N, [0]*N stack = [0] while stack: u = stack.pop() if u >= 0: stack.append(~u) for v in G[u]: G[v].remove(u) stack.append(v) else: u = ~u if not G[u]: continue H[u] = max(S[v] for v in G[u]) + 1 S[u] = min(H[v] for v in G[u]) + 1 print(H[0]) print(S[0])