human
Demiurges Shambambukli and Mazukta love to watch the games of ordinary people. Today, they noticed two men who play the following game.

There is a rooted tree on n nodes, m of which are leaves (a leaf is a nodes that does not have any children), edges of the tree are directed from parent to children. In the leaves of the tree integers from 1 to m are placed in such a way that each number appears exactly in one leaf.

Initially, the root of the tree contains a piece. Two players move this piece in turns, during a move a player moves the piece from its current nodes to one of its children.
if the player can not make a move, the game ends immediately. The result of the game is the number placed in the leaf where a piece has completed its movement. The player who makes the first move tries to maximize the result of the game and the second player, on the contrary, tries to minimize the result. We can assume that both players move optimally well.

Demiurges are omnipotent, so before the game they can arbitrarily rearrange the numbers placed in the leaves. Shambambukli wants to rearrange numbers so that the result of the game when both players play optimally well is as large as possible, and Mazukta wants the result to be as small as possible. What will be the outcome of the game, if the numbers are rearranged by Shambambukli, and what will it be if the numbers are rearranged by Mazukta? Of course, the Demiurges choose the best possible option of arranging numbers.

Input

The first line contains a single integer n — the number of nodes in the tree (1 ≤ n ≤ 2·105).

Each of the next n - 1 lines contains two integers ui and vi (1 ≤ ui, vi ≤ n) — the ends of the edge of the tree.
the edge leads from node ui to node vi. It is guaranteed that the described graph is a rooted tree, and the root is the node 1.

Output

Print two space-separated integers — the maximum possible and the minimum possible result of the game.

Examples

Input

5
1 2
1 3
2 4
2 5

Output

3 2

Input

6
1 2
1 3
3 4
1 5
5 6

Output

3...
Solve the task in PYTHON.
assistant
#Here is Python code to print two space-separated integers — the maximum possible and the minimum possible result of the game.

class Node:
    def __init__(self, id):
        self.id = id
        self.children = []
        self.best = 1000000
        self.worst = 0

def display(node, depth=0):
    print('%s%d: %d %d' % (depth * '  ', node.id, node.best, node.worst))
    for child in node.children:
        display(child, depth + 1)

n = int(raw_input())
if n == 1:
    print('1 1')
    import sys; sys.exit()
edges = [ [] for i in range(n + 1) ]
for i in range(1, n):
    u, v = map(int, raw_input().split())
    edges[u].append(v)
    edges[v].append(u)
nodes = [ Node(i) for i in range(n + 1) ]
root = nodes[1]
has_children = [ False for i in range(n + 1) ]
queue = n * [ None ]
queue[0] = root
root.depth = 0
layers = [ [] for i in range(n) ]
layers[0].append(root)
visited = [ False for i in range(n + 1) ]
visited[1] = True
tail = 0
head = 1
while tail != head:
    node = queue[tail]
    tail += 1
    u = node.id
    children = node.children
    for v in edges[u]:
        if visited[v]:
            continue
        visited[v] = True
        has_children[u] = True
        child = nodes[v]
        child.parent = node
        children.append(child)
        child.depth = node.depth + 1
        layers[child.depth].append(child)
        queue[head] = child
        head += 1
num_leaves = 0
for u in range(1, n + 1):
    if not has_children[u]:
        num_leaves += 1
        node = nodes[u]
        node.best = node.worst = 1
for depth in range(n - 1, 0, -1):
    for node in layers[depth]:
        #print('%d (%d)' % (node.id, depth))
        parent = node.parent
        parent.best = min(parent.best, node.worst)
        parent.worst += node.best
#display(root)
big = num_leaves - root.best + 1
small = root.worst
print('%d %d' % (big, small))