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>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=1e5+50;

int n,f[N],A,B,fail;
vector<int> g[N]; 

void dfs(int v,int p){
	int x=p>0;
	f[v]=p>0;
	for(int d:g[v])if(d!=p){
		++x; dfs(d,v); f[v]+=f[d];
	}
	f[v]-=x/2;
	Pr("dfs %d,%d,f=%d\n",v,p,f[v]); 
}

int G[N];
void dp2(int v,int p){
	vector<int> a; if(p>0)a.pb(1);
	for(int d:g[v])if(d!=p){dp2(d,v);a.pb(G[d]);}
	sort(all(a));if(a.size()&1){
		int Z=0;for(int l=1,r=a.size()-1;l<=r;++l,--r)if(a[l]+a[r]>B)Z=1;
		if(!Z){G[v]=1;return;}
		a.pop_back();
	}
	if(a.empty()){G[v]=1;return;}
	int m=a.size();
	lop(i,0,m)if(a[i]+a[m-1-i]>B)fail=1;
	int L=0,R=m-1;
	while(R-L>1){
		int mid=(L+R)>>1,Fail=0;
		vector<int> b;lop(i,0,m)if(i>0&&i!=mid)b.pb(a[i]);
		lop(i,0,b.size())if(b[i]+b[b.size()-1-i]>B)Fail=1;
		if(!Fail)R=mid;else L=mid;
	}
	G[v]=a[R]+1;Pr("v=%d,g=%d\n",v,G[v]);
}

bool chk(int x){
	B=x,fail=0;
	Pr("Chk %d\n",x); 
	dp2(1,0);
	return !fail;
}
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
freopen("d.in","r",stdin);freopen("m.out","w",stdout); 
#endif
	read(n); 
	rep(i,1,n-1){
		int u,v;
		read(u),read(v); 
		g[u].pb(v),g[v].pb(u); 
	}
	dfs(1,0);
	A=f[1];
	int l=0,r=n-1;
	while(r-l>1){
		int mid=(l+r)>>1;
		if(chk(mid))r=mid;else l=mid;
	}
	printf("%d %d\n",A,r);
	return 0;
}