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<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define si scanf
#define so printf
#define N 200100
#define M 
#define INF  
#define nxt t[j]
template<typename TP>inline bool rd(TP& r)
{
	r=0;
	char tmp=getchar();
	while(tmp<'0'||tmp>'9')
	{
		if(tmp==EOF)
			return 0;
		tmp=getchar();
	}
	while('0'<=tmp&&tmp<='9')
	{
		r=(r<<3)+(r<<1)+tmp-'0';
		tmp=getchar();
	}
	return 1;
	
} 
int n; 
int h[N],x[N*2],t[N*2],tot=1;
int du[N],A;
void add(int u,int v)
{
	++tot;
	x[tot]=h[u];
	h[u]=tot;
	t[tot]=v;
	++du[u];
}
int ln[N],l2[N];
int f[N];
bool ok(int mid,int u)
{
	for(int i=1;i<=ln[0];++i)
		if(i==mid)
			l2[i]=n+100;
		else
			l2[i]=ln[i];
	sort(l2+1,l2+ln[0]+1);
	for(int i=1;i<ln[0];++i)
		if(l2[i]+l2[ln[0]-i]+1>u)
			return 0;
	return 1;
}
int dp(int u)
{
	sort(ln+1,ln+ln[0]+1);
	for(int i=1;i<=ln[0]-1;++i)
		if(ln[i]+ln[ln[0]-i]+1>u)//无法配对 
			return n*12;
	ln[ln[0]+1]=n*12;
	int l=1,r=ln[0]+1,mid;
	while(l<r)
	{
		mid=(l+r)>>1;
		if(ok(mid,u))
			r=mid;
		else
			l=mid+1;
	}
	if(l>ln[0])
		return n*12;
	return ln[l]+1;
}
bool dfs(int now,int u,int fa)
{
	for(int j=h[now];j;j=x[j])
		if(nxt!=fa)
			if(dfs(nxt,u,now)==0)
				return 0;
	ln[0]=0;
	for(int j=h[now];j;j=x[j])
		if(nxt!=fa)
			ln[++ln[0]]=f[nxt];
	if(du[now]&1)
		ln[++ln[0]]=0;
	f[now]=dp(u);
	if(f[now]>u)
		return 0; 
	return 1;
}
int main()
{
	rd(n);
	int u,v;
	for(int i=1;i<n;++i)
	{
		rd(u),rd(v);
		add(u,v);
		add(v,u);
	}
	for(int i=1;i<=n;++i)
		if(du[i]&1)
			++A;
	int rt=0;
	for(int i=1;i<=n&&!rt;++i)
		if(du[i]==1)
			rt=i;
	A>>=1;
	int l=1,r=n*10,mid;
	while(l<r)
	{
		mid=(l+r)>>1;
		//memset(f,0x3f,sizeof(f));
		if(dfs(rt,mid,0))
			r=mid;
		else
			l=mid+1;
	}
	so("%d %d\n",A,l-1);
	return 0;
}