Problem: 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.

Constraints

* 2 \leq N \leq 10^5
* 1 \leq a_i,b_i \leq N
* The given graph is a tree.

Input

Input is given from Standard Input in the following format:


N
a_1 b_1
:
a_{N-1} b_{N-1}


Output

For the lexicographically smallest (A,B), print A and B with a space in between.

Examples

Input

7
1 2
2 3
2 4
4 5
4 6
6 7


Output

3 2


Input

8
1 2
2 3
3 4
4 5
5 6
5 7
5 8


Output

2 5


Input

10
1 2
2 3
3 4
2 5
6 5
6 7
7 8
5 9
10 5


Output

3 4

Solution (in CPP):

Solution:
#include <iostream>
#include <algorithm>
#include <vector>

template <class Cost = int>
struct Edge {
    int from, to;
    Cost cost;
    Edge(int to = -1, int from = -1, Cost cost = 1)
        : from(from), to(to), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};
template <class Cost = int>
using Graph = std::vector<std::vector<Edge<Cost>>>;

const int INF = std::numeric_limits<int>::max() / 3;

using namespace std;


Graph<> tree;
int A, B;

// Aを求める
void dfs1(int v, int r) {
    int ch = 0;
    for (auto e : tree[v]) {
        if (e.to == r) continue;
        ++ch;
        dfs1(e.to, v);
    }
    A += ch / 2;
}

// パスの最大長がB以下になるようにしたとき、
// 親に送られるパスの最小値(無理ならINF)を返す
int dfs2(int v, int r) {
    vector<int> ch;
    for (auto e : tree[v]) {
        if (e.to == r) continue;
        ch.push_back(dfs2(e.to, v) + 1);
        if (ch.back() > B) return INF;
    }

    // ダミーを仕込んで奇数の場合に帰着させる
    if (ch.size() % 2 == 0) ch.push_back(0);

    sort(ch.begin(), ch.end());

    int ok = ch.size(), ng = -1;
    // ok番目抜きで、和の最大値がB以下になるようマッチングできる
    while (ok - ng > 1) {
        int mid = (ok + ng) / 2;

        bool judge = true;
        for (int l = 0, r = ch.size() - 1; l < r; ++l, --r) {
            if (l == mid) ++l;
            if (r == mid) --r;
            if (ch[l] + ch[r] > B) judge = false;
        }

        (judge ? ok : ng) = mid;
    }

    return (ok == ch.size() ? INF : ch[ok]);
}

int main() {
    int N;
    cin >> N;

    tree = Graph<>(N);
    for (int i = 0; i < N - 1; ++i) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        tree[u].emplace_back(v);
        tree[v].emplace_back(u);
    }

    int r;
    for (r = 0; tree[r].size() > 1; ++r) {}

    A = 0;
    dfs1(r, -1);
    ++A;  // 根から出てくるパスを受け取る

    // Bを二分探索
    int ok = N, ng = -1;
    while (ok - ng > 1) {
        int mid = (ok + ng) / 2;
        B = mid;
        (dfs2(r, -1) <= mid ? ok : ng) = mid;
    }

    cout << A << " " << ok << endl;
    return 0;
}