#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}};
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,TRI<S,T,U>&t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

vector<int> G[MAX_N];
int dp[MAX_N];

int dfs(int u, int p)
{
    int cnt = 0, num = 0;
    for(int v : G[u]){
        if(v != p){
            dfs(v, u);
            num += dp[v];
            cnt++;
        }
    }
    dp[u] = cnt/2 + num;
    return (cnt+1)/2 + num;
}

bool check(vector<int>& vec, int num, int cri)
{
    int l = 0, r = len(vec)-1;
    for(;;++l, --r){
        if(l == num) ++l;
        if(r == num) --r;
        if(l >= r) break;
        if(vec[l]+vec[r]+2 > cri) return false;
    }
    return true;
}

bool check2(int u, vector<int>& vec, int num, int cri, int& sm)
{
    vector<int> vec2;
    if(num == len(vec)-1){
        rep(i, len(vec)-2){
            vec2.pb(vec[i]);
        }
        if(vec[num] == cri) return false;
        dp[u] = vec[num] + 1;
    }else{
        rep(i, len(vec)-1){
            if(i == num) continue;
            vec2.pb(vec[i]);
        }
        if(vec[len(vec)-1] == cri) sm++;
        if(vec[num] == cri) return false;
        dp[u] = vec[num] + 1;
    }
    rep(i, len(vec2)){
        if(vec2[i] + vec2[len(vec2)-i-1] + 2 > cri) return false;
    }
    return true;
}

bool dfs2(int u, int p, int cri, int& sm)
{
    vector<int> vec;
    for(int v : G[u]){
        if(v != p){
            if(!dfs2(v, u, cri, sm)) return false;
            vec.pb(dp[v]);
        }
    }
    sort(all(vec));
    if(len(vec) % 2){
        sm += len(vec)/2;
        if(check(vec, 0, cri)){
            if(vec[0] == cri){
                dp[u] = 1;
                sm++;
                return true;
            }else{
                dp[u] = vec[0] + 1;
                return true;
            }
        }else if(!check(vec, len(vec)-1, cri)){
            return false;
        }else{
            int l = 0, r = len(vec)-1;
            while(r-l>1){
                int mid = (l+r)/2;
                if(check(vec, mid, cri)){
                    r = mid;
                }else{
                    l = mid;
                }
            }
            if(vec[r] == cri){
                dp[u] = 1;
                sm++;
                return true;
            }else{
                dp[u] = vec[r] + 1;
                return true;
            }
        }
    }else{
        sm += len(vec)/2;
        bool flag = true;
        rep(i, len(vec)){
            if(vec[i] + vec[len(vec)-i-1] + 2 > cri){
                flag = false;
                break;
            }
        }
        if(flag){
            dp[u] = 0;
            return true;
        }
        int res = 0;
        if(check2(u, vec, 0, cri, res)){
            sm += res;
            return true;
        }else if(!check2(u, vec, len(vec)-1, cri, res)){
            return false;
        }else{
            int l = 0, r = len(vec)-1;
            while(r-l>1){
                int mid = (l+r)/2;
                if(check2(u, vec, mid, cri, res)){
                    r = mid;
                }else{
                    l = mid;
                }
            }
            check2(u, vec, r, cri, sm);
            return true;
        }
    }
    return false;
}

bool possible(int cri, int a)
{
    int sm = 0;
    if(!dfs2(0, -1, cri, sm)) return false;
    if(dp[0]) sm++;
    assert(sm >= a);
    return (sm == a);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        G[a-1].pb(b-1), G[b-1].pb(a-1);
    }
    int a = dfs(0, -1);
    int l = 0, r = n;
    while(r-l>1){
        int mid = (l+r)/2;
        if(possible(mid, a)){
            r = mid;
        }else{
            l = mid;
        }
    }
    cout << a << " " << r << "\n";
    return 0;
}


Measured memory_bytes: 18048