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<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const int big=1e9+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
int n;
vector<vector<int>>hen;
vector<int>ki;//is kisu
int solve(int ter,int oya,int bgen){
	//解きます
	//cerr<<ter<<endl;
	multiset<int>soi;
	if(ki[ter]){soi.ins(0);}
	for(auto it:hen[ter]){
		if(it==oya){continue;}
		int kae=solve(it,ter,bgen);
		if(kae==-1){return -1;}
		soi.ins(kae);
	}
	//bgen以下を作る貪欲法
	//soiは1あまる
	//setで殴りすぎlogがひどい
	int sta=-1;
	while(soi.size()>1){
		int mae=*prev(soi.end());
		soi.era(prev(soi.end()));
		auto itr=soi.upper_bound(bgen-mae);
		if(itr==soi.begin()){//ないので
			if(sta!=-1){return -1;}
			else{sta=mae;}
		}
		else{soi.era(prev(itr));}
	}
	if(sta>bgen){return -1;}
	if(soi.size()==1){sta=*soi.begin();}
	if(oya!=-1){return sta+1;}
	else{return 0;}
}
int main(void){
	int i;
	cin>>n;hen.res(n);ki.res(n);
	for(i=0;i<n-1;i++){
		int a,b;cin>>a>>b;a--;b--;
		hen[a].pub(b);ki[a]=(!ki[a]);
		hen[b].pub(a);ki[b]=(!ki[b]);
	}
	int A=0,ha=-1;
	for(i=0;i<n;i++){if(ki[i]){A++;}if(hen[i].size()==1){ha=i;}}
	cout<<A/2<<" ";
	int bmax=n,bmin=0;
	while(bmax-bmin>1){
		int bgen=(bmax+bmin)/2;
		if(solve(ha,-1,bgen)!=-1){bmax=bgen;}
		else{bmin=bgen;}
	}
	cout<<bmax<<endl;
	RE;
}