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 pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

vi g[MAXN];

int dp[MAXN];
int prv[MAXN];
int vv[MAXN], top_vv;
int sorted[MAXN], top_sorted;

void dfs(int s) {
	REP(i, 0, SZ(g[s])) {
		int to = g[s][i];
		if (to != prv[s]) {
			prv[to] = s;
			dfs(to);
		}
	}
	sorted[top_sorted++] = s;
}

void solve(){
	int n;
	scanf("%d", &n);
	REP(i, 1, n) {
		int a, b;
		scanf("%d%d", &a, &b);
		g[a].pb(b);
		g[b].pb(a);
	}
	
	int cnt = 0;
	REPN(i, 1, n) {
		cnt += SZ(g[i]) % 2;
	}
	cnt /= 2;
	
	int ind = 0;
	REPN(i, 1, n) {
		if (SZ(g[i]) == 1) {
			ind = i;
			break;
		}
	}
	dfs(ind);
	
	int l = 0, r = n - 1;
	for(; l + 1 < r; ) {
		int lim = (l + r) >> 1;
		bool good = true;
		REP(i, 0, n) {
			int s = sorted[i];
			dp[s] = 0;
			top_vv = 0;
			REP(j, 0, SZ(g[s])) {
				int to = g[s][j];
				if (to != prv[s]) {
					vv[top_vv++] = dp[to] + 1;
				}
			}
			
			if (top_vv % 2 == 0) {
				vv[top_vv++] = 0;
			}
			
			sort(vv, vv + top_vv);
			
			if (vv[top_vv - 1] > lim) {
				good = false;
			} else {
				for(int ind_r = top_vv / 2, ind_l = top_vv / 2 - 1; ind_l >= 0; ind_l--, ind_r++) {
					if (vv[ind_r] + vv[ind_l] > lim) {
						good = false;
						break;
					}
				}
			}
			if (good) {
				int ind = top_vv - 1;
				for(ind--; ind >= 0; ind--) {
					if (ind >= top_vv / 2) {
						if (vv[ind + 1] + vv[top_vv - 2 - ind] > lim) {
							break;
						}
					} else {
						if (vv[ind + 1] + vv[top_vv - 1 - ind] > lim) {
							break;
						}
					}
				}
				ind++;
				dp[s] = vv[ind];
			}
			
			if (!good) {
				break;
			}
		}
		
		if (good) {
			r = lim;
		} else {
			l = lim;
		}
	}
	
	printf("%d %d\n", cnt, r);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}