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

using Graph=vector<vector<int>>;

int dfsA(int v,int pre,Graph &g){
    int sum=0;
    int res=0;
    for(int i=0;i<g[v].size();i++){
        if(g[v][i]!=pre){
            sum++;
            res+=dfsA(g[v][i],v,g);
        }
    }
    if(v==0){
        return (sum+1)/2+res;
    }
    else{
        return sum/2+res;
    }
}

int dfsB(int v,int pre,int bound,Graph &g){
    vector<int> len;
    for(int i=0;i<g[v].size();i++){
        if(g[v][i]!=pre) len.push_back(dfsB(g[v][i],v,bound,g)+1);
    }
    if(len.size()==0) return 0;
    sort(len.begin(),len.end());
    if(v!=0){
        if(len.size()%2==0){
            bool isbad=false;
            for(int i=0;i<len.size();i++){
                isbad|=(len[i]+len[len.size()-1-i]>bound);
            }
            if(!isbad) return 0;
            if(len.back()>bound) return bound+1;
            len.pop_back();
        }
        int lb=-1;
        int ub=len.size();
        while(ub-lb>1){
            int mid=(ub+lb)/2;
            int l=-1,r=len.size();
            bool isbad=false;
            while(true){
                if(l+1!=mid) l++;
                else l+=2;
                if(r-1!=mid) r--;
                else r-=2;
                assert(l!=r);
                if(len.size()<=l) break;
                isbad|=(len[l]+len[r]>bound);
            }
            if(isbad) lb=mid;
            else ub=mid;
        }
        if(ub==len.size()) return bound+1;
        else return len[ub];
    }
    else{
        if(len.size()%2==1){
            if(len.back()>bound) return bound+1;
            len.pop_back();
        }
        bool isbad=false;
        for(int i=0;i<len.size();i++){
            isbad|=(len[i]+len[len.size()-1-i]>bound);
        }
        if(isbad) return bound+1;
        else return 0;
    }
}
int main(){
    int n;
    cin>>n;
    Graph g(n);
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a>>b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int A=dfsA(0,-1,g);
    cout<<A<<" ";
    int lb=0;
    int ub=n;
    while(ub-lb>1){
        int mid=(ub+lb)/2;
        int res=dfsB(0,-1,mid,g);
        if(res<=mid){
            ub=mid;
        }
        else{
            lb=mid;
        }
    }
    cout<<ub<<endl;
    return 0;
}