#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=1e5+10;
vector<int> es[L];
int m;
int f(int r,int p) {
	vector<int> len;
	for(int i:es[r]){
		if(i==p)continue;
		int v=f(i,r);
		if(v>m){
			return m+1;
		}
		len.push_back(v);
	}
	if(len.size()%2==0){
		len.push_back(0);
	}
	sort(len.begin(),len.end());
	int low=-1;
	int hi=len.size();
	while(low+1<hi){
		int c=(low+hi)/2;
		int h=0;
		int t=len.size()-1;
		if(h==c)h++;
		if(t==c)t--;
		bool ok=true;
		while(h<t){
			if(len[h]+len[t]>m){
				ok=false;
				break;
			}
			h++;
			t--;
			if(h==c)h++;
			if(t==c)t--;
		}
		if(ok){
			hi=c;
		}
		else{
			low=c;
		}
	}
	if(hi<len.size()){
		//cerr << m << ", " << r << ", " << p << ", " << len[hi]+1 << endl;
		return len[hi]+1;
	}
	return m+1;
}
int main() {
	int N;
	cin >> N;
	for(int i=0;i<N-1;i++){
		int a,b;
		cin >> a >> b;
		es[a].push_back(b);
		es[b].push_back(a);
	}
	int c=0;
	int s=0;
	for(int i=1;i<=N;i++){
		c+=es[i].size()%2;
		if(es[i].size()==1){
			s=i;
		}
	}

	int low=0,hi=N-1;
	while(low+1<hi){
		m=(low+hi)/2;
		//cerr << low << ", " << hi << ", " << m << ": " << f(s,0) << endl;
		if(f(es[s][0],s)<=m){
			hi=m;
		}
		else{
			low=m;
		}
	}
	cout << c/2 << " " << hi << endl;

	return 0;
}

