#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; scanf("%d", &n);
    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v; scanf("%d%d", &u, &v);
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    vector<int> dp(n), cnt(n);
    function<void(int, int)> Dfs = [&](int x, int p) {
        int ch = 0;
        for (int u : g[x]) {
            if (u == p) continue;
            Dfs(u, x);
            dp[x] += dp[u];
            ch += 1;
        }
        dp[x] -= ch / 2;
        if (ch % 2 == 0 && x != 0) dp[x]++;
    };

    Dfs(0, -1);
    int A = dp[0], B = n + 1;

    auto Check = [&](int v) {
        constexpr int kInf = 1'000'000'000;
        function<void(int, int)> Dfs = [&](int x, int p) {
            multiset<int> s;
            dp[x] = kInf;
            cnt[x] = 0;
            for (int u : g[x]) {
                if (u == p) continue;
                Dfs(u, x);
                if (dp[u] > v) return;
                s.insert(dp[u]);
                cnt[x] += cnt[u];
            }
            if (s.size() & 1) {
                int z = kInf;
                while (!s.empty()) {
                    int r = *s.rbegin();
                    s.erase(s.find(r));
                    auto it = s.upper_bound(v - r); 
                    if (it == s.begin()) {
                        z = min(z, r);
                    } else {
                        s.erase(prev(it));
                        cnt[x]--;
                    }
                }
                dp[x] = z;
                if (x != 0) dp[x]++;
                if (dp[x] > v) {
                    dp[x] = kInf;
                    return;
                }
            } else {
                auto f = s;
                bool ok = true;
                int kc = cnt[x], z = kInf;
                while (!s.empty()) {
                    int r = *s.rbegin();
                    s.erase(s.find(r));
                    auto it = s.upper_bound(v - r); 
                    if (it == s.begin()) {
                        z = min(z, r);
                    } else {
                        cnt[x]--;
                        s.erase(prev(it));
                    }
                }
                if (z + 1 > v && x > 0) {
                    dp[x] = 1;
                    cnt[x]++;
                } else {
                    dp[x] = z + 1;
                }
                // cnt[x] = kc;
                // auto it = f.upper_bound(x == 0 ? v : v - 1);
                // if (it == f.begin()) return;
                // dp[x] = *prev(it);
                // if (x != 0) dp[x]++;
                // f.erase(prev(it));
                // int z = -1;
                // while (!f.empty()) {
                    // int r = *f.rbegin();
                    // f.erase(f.find(r));
                    // auto it = f.upper_bound(v - r); 
                    // if (it == f.begin()) {
                        // ;
                    // } else {
                        // f.erase(prev(it));
                        // cnt[x]--;
                    // }
                // }
            }
            // printf("dp[%d] = %d\n", x + 1, dp[x]);
            // printf("cnt[%d] = %d\n", x + 1, cnt[x]);
        };
        // printf("Check v = %d\n", v);
        Dfs(0, -1);
        // printf("cnt = %d dp = %d\n", cnt[0], dp[0]);
        return cnt[0] == A && dp[0] != kInf;
    };

    for (int d = 20; d >= 0; --d) {
        if (B - (1 << d) <= 0) continue;
        if (Check(B - (1 << d))) B -= (1 << d);
    }
    printf("%d %d\n", A, B);
    return 0;
}


Measured memory_bytes: 26496