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<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
typedef long double ld;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
bool ok;
int nxt[500010],f[500010],d[500010],l,r,o,ans,L,R,O,n,x,y,hed[500010],too[500010],nedge,stk[500010],top;
void ae(int x,int y){
	nxt[++nedge]=hed[x];
	hed[x]=nedge;
	too[nedge]=y;
}
bool check(int o){
	int p=0,q=top+1;
	FOR(i,1,top/2){
		++p,--q;
		if (p==o) ++p;
		if (q==o) --q;
		if (stk[p]+stk[q]>O) return 0;
	}
	return 1;
}
void dfs(int x,int l){
	if (!ok) return;
	for (int i=hed[x];i;i=nxt[i]){
		int y=too[i];
		if (y==l) continue;
		dfs(y,x);
	}
	top=0;
	for (int i=hed[x];i;i=nxt[i]){
		int y=too[i];
		if (y==l) continue;
		stk[++top]=f[y];
		if (f[y]==-1){ok=0;return;}
	}
	if (x==1){
		sort(stk+1,stk+top+1);
		if (top&1) ok&=check(top);
		else ok&=check(-1);
		return;
	}
	if (d[x]%2==0){
		sort(stk+1,stk+top+1);
		if (!check(top)){f[x]=-1;return;}
		l=1,r=top;
		while (l<r){
			o=l+r>>1;
			if (check(o)) r=o;
			else l=o+1;
		}
		f[x]=(stk[r]+1<=O)?stk[r]+1:(-1);
	}
	else{
		stk[++top]=0;
		sort(stk+1,stk+top+1);
		if (!check(top)){f[x]=-1;return;}
		l=1,r=top;
		while (l<r){
			o=l+r>>1;
			if (check(o)) r=o;
			else l=o+1;
		}
		f[x]=(stk[r]+1<=O)?stk[r]+1:(-1);
	}
}
int main(){
	scanf("%d",&n);
	FOR(i,2,n){
		getint(x),getint(y);
		ae(x,y),ae(y,x);
		++d[x],++d[y];
	}
	FOR(i,1,n) ans+=d[i]&1;
	cout<<ans/2<<' ';
	++d[1];
	L=1,R=n;
	while (L<R){
		O=L+R>>1;
		ok=1;
		dfs(1,0);
		if (ok) R=O;
		else L=O+1;
	}
	cout<<R<<endl;
	return 0;
}