#include<cstdio>
#include<algorithm>
#include<cstring>
#include<set>
#define MN 100005
using namespace std;
int n,num,cnt,now[MN],f[MN],head[MN],pre[MN],lst[MN];
struct edge{int to,next;}g[MN<<1];
multiset<int>::iterator it,it2;
void ins(int u,int v){g[++num].next=head[u];head[u]=num;g[num].to=v;}
bool dp(int u,int ff,int mid){
	int tt=0,lef=0;
	for(int i=head[u];i;i=g[i].next)if(g[i].to!=ff)if(!dp(g[i].to,u,mid))return false;
	multiset<int>S;S.clear();
	for(int i=head[u];i;i=g[i].next)if(g[i].to!=ff)S.insert(f[g[i].to]),tt++;
	if(!tt){f[u]=0;return true;}
	while(S.begin()!=S.end()){
		it=S.end();--it;int tmp=(*it);S.erase(it);
		it2=S.upper_bound(mid-tmp-2);
		if(it2!=S.begin()){--it2;S.erase(it2);}
		else {lst[++lef]=tmp;}
	}
	if(u==1){
		if(lef==1)return lst[1]+1<=mid;
		else return lef==0;
	}else {
		if(tt&1){
			if(lef==1){f[u]=lst[lef]+1;return lst[1]+1<=mid;}
			else {f[u]=0;return lef==0;}
		}else {
			if(lef==2){f[u]=lst[2]+1;return f[u]<=mid&&lst[1]+1<=mid;}
			else {f[u]=0;return lef==0;}
		}
	}
}
void calc(int u,int ff){
	int tt=0;
	for(int i=head[u];i;i=g[i].next)if(g[i].to!=ff)calc(g[i].to,u),tt++;
	cnt+=(u==1?(tt+1)/2:tt/2);
}
int main(){
	scanf("%d",&n);int x,y;
	for(int i=1;i<n;i++)scanf("%d%d",&x,&y),ins(x,y),ins(y,x);
	int l=1,r=1e5,ans=1e5;
	while(l<=r){
		int mid=(l+r)>>1;
		if(dp(1,1,mid))ans=mid,r=mid-1;
		else l=mid+1;
	}calc(1,1);printf("%d %d",cnt,ans);
}