/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(__,v.size()){rep(_,v[__].size())cout<<" "<<v[__][_];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

int n,h;
vvi G;

int f(vi a,int b){
	int l=0,r=a.size()-1;
	while(l<r){
		if(l==b)l++;
		if(r==b)r--;
		if(a[l]+a[r]>h)return false;
		l++;r--;
	}
	return true;
}
int dfs(int a,int p){
	vi t;
	rep(i,G[a].size()){
		int to=G[a][i];
		if(to==p)continue;
		t.pb(1+dfs(to,a));
	}
	if(t.size()==0)return 0;
	if(t.size()==1)return t[0];
	sort(all(t));
	if(t.back()>h)return inf;
	int out=inf;
	if(t.size()%2==0&&f(t,-1))out=0;
	if(!a&&t.size()%2==0)return out;
	if(t.size()%2==0){
		auto it=t.end();
		it--;
		t.erase(it);
	}
	int l=-1,r=t.size()-1;
	while(r-l>1){
		int hh=(l+r)/2;
		if(f(t,hh))r=hh;
		else l=hh;
	}
	if(f(t,r))cmin(out,t[r]);
	return out;
}
signed main(){
	cin>>n;
	G=vvi(n);
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	int A=1;
	rep(i,n)A+=(G[i].size()-1)/2;
	cout<<A<<" ";
	int l=-1,r=n-1;
	while(r-l>1){
		h=(l+r)/2;
		if(dfs(0,-1)>h)l=h;
		else r=h;
	}
	cout<<r<<endl;
}















Measured memory_bytes: 23040