#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


struct Graph {
    Graph(const int n)
    {
        edge.resize(n);
    }
    void addEdge(const int from, const int to)
    {
        edge[from].push_back(to);
    }
    vector<vector<int>> edge;
};

void make_dfs(const Graph& g_, Graph& g, const int s, vector<bool>& used)
{
    used[s] = true;
    for (const int to : g_.edge[s]) {
        if (not used[to]) {
            g.addEdge(s, to);
            make_dfs(g_, g, to, used);
        }
    }
}

int a_dfs(const Graph& g, const int s)
{
    const int C = g.edge[s].size();
    int sum = C / 2;
    for (const int to : g.edge[s]) {
        sum += a_dfs(g, to);
    }
    return sum;
}

int K;
bool check(const vector<int>& a, const int ng, const int size)
{
    int tail = size - 1;
    for (int i = 0; i < size; i++, tail--) {
        if (tail == ng) {
            tail--;
        }
        if (i == ng) {
            i++;
        }
        if (tail <= i) {
            break;
        }
        const int sum = a[i] + a[tail];
        if (sum + 1 > K) {
            return false;
        }
    }
    return true;
}

bool b_bfs(const Graph& g, const int s, vector<int>& dp)
{
    const int C = g.edge[s].size();
    vector<int> l;
    for (const int to : g.edge[s]) {
        const bool f = b_bfs(g, to, dp);
        if (not f) {
            return false;
        }
        l.push_back(dp[to]);
    }
    sort(l.begin(), l.end());
    if (C % 2 == 1) {
        int inf = 0;
        int sup = C;
        while (inf < sup) {
            const int mid = (inf + sup) / 2;
            if (check(l, mid, C)) {
                sup = mid;
            } else {
                if (inf == mid) {
                    break;
                }
                inf = mid;
            }
        }
        if (sup == C or l[sup] + 1 > K) {
            return false;
        } else {
            dp[s] = l[sup] + 1;
            return true;
        }
    } else {
        if (check(l, C, C)) {
            dp[s] = 1;
            return true;
        } else if (l.back() + 1 > K) {
            return false;
        } else {
            int inf = 0;
            int sup = C - 1;
            while (inf < sup) {
                const int mid = (inf + sup) / 2;
                if (check(l, mid, C - 1)) {
                    sup = mid;
                } else {
                    if (inf == mid) {
                        break;
                    }
                    inf = mid;
                }
            }
            if (sup == C - 1 or l[sup] + 1 > K) {
                return false;
            } else {
                dp[s] = l[sup] + 1;
                return true;
            }
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    Graph g_(N);
    vector<int> dim(N, 0);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g_.addEdge(a, b);
        g_.addEdge(b, a);
        dim[a]++;
        dim[b]++;
    }
    int root = 0;
    for (; root < N; root++) {
        if (dim[root] == 1) {
            break;
        }
    }
    Graph g(N);
    vector<bool> used(N, false);
    make_dfs(g_, g, root, used);
    const int A = a_dfs(g, root) + 1;

    vector<int> dp(N, 0);
    int inf = 0;
    int sup = N;
    while (inf < sup) {
        K = (inf + sup) / 2;
        const bool ok = b_bfs(g, root, dp);
        if (ok) {
            sup = K;
        } else {
            if (inf == K) {
                break;
            }
            inf = K;
        }
    }
    K = sup;
    b_bfs(g, root, dp);
    const int B = sup - 1;
    cout << A << " " << B << endl;

    return 0;
}


Measured memory_bytes: 24448