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"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (100006)
ll n;
pi dp[MAXN];
vector<int>v[MAXN];
bool tryy(ll i){
	function<void(ll,ll,ll)>dfs=[&](ll x,ll p,ll d){
		dp[x]=pi(0,0);
		multiset<ll,greater<ll>> s;
		for(auto i:v[x]) if(i^p) {
			dfs(i,x,d), dp[x].f += dp[i].f;
			if(dp[i].s+1==d){
				++ dp[x].f;
			}else{
				s.ins(dp[i].s);
			}
		}
		while(s.size()){
			ll y=*s.begin();
			auto other=s.lower_bound(d-y-1);
			if(s.size() == 1 || other==s.end()) {
				dp[x].f += dp[x].s > 0;
				dp[x].s = y;
				s.erase(s.begin());
				continue;
			}
			if(other==s.begin())++other;
			assert(y+*other+1 <= d);
			s.erase(other), s.erase(s.begin());
			++dp[x].f;
		}
		dp[x].s += x != 1;
		if(x==1){
			if(dp[x].s) ++ dp[x].f, dp[x].s=0;
		}
	};
	auto bstar=[&](ll x){
		dfs(1,1,x);
		return dp[1].f <= i;
	};
	ll st=1, en=n+1;
	while(en-st>1){
		ll mid=(st+en)>>1;
		if(bstar(mid))en=mid;
		else st=mid;
	}
	if(en==n+1) return 0;
	cout<<i<<' '<<en-1<<'\n';
	return 1;
}
int main(){
	FAST
	cin>>n;
	FOR(i,0,n-2){
		ll a,b;
		cin>>a>>b;
		v[a].eb(b), v[b].eb(a);
	}
	ll ans=0;
	FOR(i,1,n)ans+=v[i].size()&1;
	ans /= 2;
	assert(tryy(ans));
}