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<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 100005

int n,m,tot,pps,pp;
int now[maxn],pre[maxn*2],son[maxn*2],deg[maxn],f[maxn];

inline int read(){
	int x=0,f=1; char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

inline void print(int x){
	if (x<0){putchar('-'); x=-x;}
	if (x>=10) print(x/10);
	putchar(x%10+'0');
}

void add(int a,int b){son[++tot]=b,pre[tot]=now[a],now[a]=tot;}
void link(int a,int b){add(a,b),add(b,a),++deg[a],++deg[b];}

int top;
int stack[maxn];
bool can;

bool check1(int x){
	for (int i=1,j=top;i<j;i++,j--){
		if (i==x) ++i; if (j==x) --j; if (i>=j) break;
		if (stack[i]+stack[j]>pps) return 0;
	}
	return 1;
}

void tree_dp(int x,int fa){
	if (!can) return;
	for (int p=now[x];p;p=pre[p])
		if (son[p]!=fa) tree_dp(son[p],x);
	top=0;
	for (int p=now[x];p;p=pre[p])
		if (son[p]!=fa) stack[++top]=f[son[p]];
	if (~top&1) stack[++top]=0;
	sort(stack+1,stack+top+1);
	int l=1,r=top,res=-1;
	while (l<=r){
		int mid=(l+r)>>1;
		if (check1(mid)) res=mid,r=mid-1;
		else l=mid+1;
	}
	if (res==-1){can=0; return;}
	f[x]=stack[res]+1;
}

bool check(int x){
	memset(f,0,sizeof(f));
	pps=x,can=1; tree_dp(pp,0);
	//	for (int i=1;i<=n;i++) printf("%d %d\n",i,f[i]);
	return can&&f[pp]<=x+1;
}

int main(){
	n=read();
	for (int i=1,x,y;i<n;i++) x=read(),y=read(),link(x,y);
	int ans=0;
	for (int i=1;i<=n;i++) ans+=deg[i]&1; cout<<(ans>>1)<<' ';
	for (int i=1;i<=n;i++) if (deg[i]==1){pp=i; break;}
	int l=1,r=n,res=n+1;
	while (l<=r){
		int mid=(l+r)>>1;
		if (check(mid)) r=mid-1,res=mid;
		else l=mid+1;
	}
	cout<<res<<endl;
	return 0;
}