Problem: Takahashi has decided to make a Christmas Tree for the Christmas party in AtCoder, Inc.

A Christmas Tree is a tree with N vertices numbered 1 through N and N-1 edges, whose i-th edge (1\leq i\leq N-1) connects Vertex a_i and b_i.

He would like to make one as follows:

* Specify two non-negative integers A and B.
* Prepare A Christmas Paths whose lengths are at most B. Here, a Christmas Path of length X is a graph with X+1 vertices and X edges such that, if we properly number the vertices 1 through X+1, the i-th edge (1\leq i\leq X) will connect Vertex i and i+1.
* Repeat the following operation until he has one connected tree:
* Select two vertices x and y that belong to different connected components. Combine x and y into one vertex. More precisely, for each edge (p,y) incident to the vertex y, add the edge (p,x). Then, delete the vertex y and all the edges incident to y.
* Properly number the vertices in the tree.



Takahashi would like to find the lexicographically smallest pair (A,B) such that he can make a Christmas Tree, that is, find the smallest A, and find the smallest B under the condition that A is minimized.

Solve this problem for him.

Constraints

* 2 \leq N \leq 10^5
* 1 \leq a_i,b_i \leq N
* The given graph is a tree.

Input

Input is given from Standard Input in the following format:


N
a_1 b_1
:
a_{N-1} b_{N-1}


Output

For the lexicographically smallest (A,B), print A and B with a space in between.

Examples

Input

7
1 2
2 3
2 4
4 5
4 6
6 7


Output

3 2


Input

8
1 2
2 3
3 4
4 5
5 6
5 7
5 8


Output

2 5


Input

10
1 2
2 3
3 4
2 5
6 5
6 7
7 8
5 9
10 5


Output

3 4

Solution (in CPP):

Solution:
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
long long int mod = 4294967296;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(15)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll rui(ll abc,ll bed){
    //abcのbed乗を計算する
    if(bed==0){return 1;}
    else{
        ll ced = rui(abc,bed/2);
        ced *= ced;
        ced %= mod;
        if(bed%2==1){ced*=abc; ced%=mod;}
        return ced;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,ans,a,b,c,d,e,f,g,h,i,j,k,w,ok,ng;
ll t[500005],l[500005],r[500005];
ll dp[5005][5005][3];
bool flag,dame;

ll solve(ll node,ll parent,ll length){
	//nodeを見ている
	//親がparent
	//length以下にする
	vector <ll> table;
	for(int i=0;i<G[node].size();i++){
		if(G[node][i] == parent)continue;
		ll b = solve(G[node][i],node,length);
		if(b != -1){
			table.pb(b);
		}
	}
	if(G[node].size() % 2 == 1)table.pb(0ll);
	sort(table.begin(),table.end());
	bool flag = false;
	c = -1;
	if(table.size() % 2 == 0)flag = true;
	while(table.size() >= 2){
		a = table.back();
		table.pop_back();
		ll de = lb(table.begin(),table.end(),length - a + 1) - table.begin();
		de--;
		if(de < 0 && !flag){
			flag = true;
			c = a;
		}else if(de < 0){
			dame = true;
			return INF;
		}else{
			table.erase(table.begin() + de);
		}
	}
	if(c != -1){
		table.pb(c);
	}
	if(table.size() == 1){
		return table[0] + 1;
	}else{
		return -100;
	}
}


int main(){
    cin >> n;
	for(i=0;i<n-1;i++){
		cin >> a >> b;
		G[a].pb(b);
		G[b].pb(a);
	}
	a = 0;
	for(i=1;i<=n;i++){
		if(G[i].size() % 2 == 1){
			a++;
		}
	}
	num = 1;
	assert(a % 2 == 0);
	a /= 2;
	pe(a);
	ng = -1;
	ok = n + 10;
	while(ok - ng > 1){
		ll mid = (ok + ng) / 2;
		//pe(mid);
		dame = false;
		ll ans = solve(num,-1,mid);
		//assert(ans == 0 || ans == INF);
		//p(ans);
		if(dame || ans != -100){
			ng = mid;
		}else{
			ok = mid;
		}
	}
	p(ok);
	return 0;
}