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<bits/stdc++.h>
using namespace std;

#define rep(i,l,r) for(register int i = l ; i <= r ; i++)
#define repd(i,r,l) for(register int i = r ; i >= l ; i--)
#define rvc(i,S) for(register int i = 0 ; i < (int)S.size() ; i++)
#define rvcd(i,S) for(register int i = ((int)S.size()) - 1 ; i >= 0 ; i--)
#define fore(i,x)for (register int i = head[x] ; i ; i = e[i].next)
#define forup(i,l,r) for (register int i = l ; i <= r ; i += lowbit(i))
#define fordown(i,id) for (register int i = id ; i ; i -= lowbit(i))
#define pb push_back
#define prev prev_
#define stack stack_
#define mp make_pair
#define fi first
#define se second
#define lowbit(x) (x&(-x))

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll,int> pr;

const int inf = 2e8;
const int maxn = 100020;
const ll mod = 1e9 + 7;
struct node{
	int next,to,w;
}e[maxn * 2];

int head[maxn],cnt,rt,sz[maxn],n,deg[maxn];
int len,flag;

inline void adde(int x,int y){
	e[++cnt].to = y;
	e[cnt].next = head[x];
	head[x] = cnt;
}

void dfs(int x,int fa){
	fore(i,x){
		if ( e[i].to == fa ) continue;
		dfs(e[i].to,x);
		deg[x]++;	
	}
}
struct cmp{
	bool operator () (int x,int y){ return x > y; }
};
multiset <int,cmp> vec[maxn];
int dfs2(int x,int fa){
	fore(i,x){
		if ( e[i].to == fa ) continue;
		vec[x].insert(dfs2(e[i].to,x));
		if ( !flag ) return 0;
	}
//	sort(vec[x].begin(),vec[x].end());
	if ( !vec[x].size() ) return 1;
	if ( x == 1 ){
		if ( vec[x].size() & 1 ){
		   	flag &= *vec[x].begin() <= len;
			vec[x].erase(vec[x].begin());
		}
		if ( vec[x].size() ){
			auto it = vec[x].end();
			for (auto it2 = vec[x].begin() ; it2 != vec[x].end() ; ++it2){
				--it;
				flag &= ((*it) + (*it2)) <= len;
			}
		}
		return 0;
	}
	int l = 0;
	if ( !(vec[x].size() & 1) ){
		int cnt = 0,tag = 0;
		for (auto it = vec[x].begin() ; it != vec[x].end() ; ++it){
			if ( *it > len ){ flag =0 ; return 0; }
			if ( (*it) * 2 <= len ) break;
			auto it2 = vec[x].lower_bound(len - *it);
			if ( it2 == vec[x].end() ){
				if ( !tag ) tag = 1;
				else if ( !l ) l = (*it) + 1;
				else{ flag = 0; return 0; }
			}
			else vec[x].erase(it2);
	//		vec[x].erase(it);
			++cnt;
			if ( cnt >= vec[x].size() ) break;
		}
		auto it = vec[x].end();
		if ( !l ){
		   	if ( tag ) l = (*(--it)) + 1;
			else l = 1;
		}
	}
	else{
		int cnt = 0;
		for (auto it = vec[x].begin() ; it != vec[x].end() ; ++it){
			if ( *it > len ){ flag =0 ; return 0; }
			if ( (*it) * 2 <= len ) break;
			auto it2 = vec[x].lower_bound(len - *it);
			if ( it2 == vec[x].end() ){
				if ( !l ) l = (*it) + 1;
				else{ flag = 0; return 0; }
			}
			else vec[x].erase(it2);
	//		vec[x].erase(it);
			++cnt;
			if ( cnt >= vec[x].size() ) break;
		}
		auto it = vec[x].end();
		if ( !l ) l = (*(--it)) + 1;
	}
	return l;
}
int check(int mid){
	rep(i,1,n) vec[i].clear();
	flag = 1;
	len = mid;
	dfs2(1,0);
	return flag;
}
int main(){
	scanf("%d",&n);
	rep(i,1,n - 1){
		int x,y;
		scanf("%d %d",&x,&y);
		adde(x,y) , adde(y,x);
	}
	dfs(1,0);
	int A = 0,B = 0;
	rep(i,1,n){
		if ( i == 1 ) A += (deg[i] + 1) / 2;
		else A += deg[i] / 2;
	}
	int l = 1 , r = n;
	while ( l <= r ){
		int mid = (l + r) >> 1;
		if ( check(mid) ) B = mid , r = mid - 1;
		else l = mid + 1;
	}
	cout<<A<<" "<<B<<endl;
}