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
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

typedef long long ll;
typedef long double ld;

const ll INF = 1e8, SZ = 1e5 + 10;

ll n;
vector<vector<ll>> gr;
bool used[SZ];

bool fl = true;

ll bst(vector<ll> &vec, int ln) {
	int l = -1, r = vec.size() - 1;
	while (r - l > 1) {
		int mid = (l + r) / 2;
		vector<ll> vec2 = vec;
		vec2.erase(vec2.begin() + mid);
		ll maxS = 0;
		for (int i = 0; i < vec2.size(); i++) {
			ll rv = vec2.size() - i - 1;
			if (i == rv) {
				maxS = max(maxS, vec2[i]);
			}
			else {
				maxS = max(maxS, vec2[i] + vec2[rv] - 1);
			}
		}
		if (maxS > ln) {
			l = mid;
		}
		else {
			r = mid;
		}
	}

	return vec[r];
}

ll dp(int v, int l) {
	used[v] = 1;

	vector<ll> vals;
	for (auto to : gr[v]) {
		if (!used[to]) {
			vals.push_back(dp(to, l) + 1);
			if (vals.back() > l) fl = false;
		}
	}

	if (gr[v].size() == 1 && vals.size() == 1) {
		if (vals[0] > l) {
			fl = false;
		}
		return 0;
	}
	if (gr[v].size() == 1) return 1;
	if (gr[v].size() == 2) return vals[0];

	sort(vals.begin(), vals.end());
	if (gr[v].size() % 2 == 1) {
		ll maxS = 0;
		for (int i = 0; i < vals.size(); i++) {
			ll rv = vals.size() - i - 1;
			if (i == rv) {
				maxS = max(maxS, vals[i]);
			}
			else {
				maxS = max(maxS, vals[i] + vals[rv] - 1);
			}
		}

		if (maxS <= l) return 1ll;
		if (vals.back() > l) {
			fl = false;
		}
		vals.pop_back();
	}

	for (int i = 0; i < vals.size() - 1; i++) {
		ll rev = vals.size() - 2 - i;
		if (i == rev && vals[i] > l) {
			fl = false;
		}
		if (i != rev && vals[i] + vals[rev] - 1 > l) {
			fl = false;
		}
	}

	if (!fl) return 0;

	return bst(vals, l);
}

bool fl2 = true;
bool check(int l) {
	fl = true;
	fl2 = true;

	if (l == 2) {
		cout << "";
	}
	for (int i = 0; i < n; i++) used[i] = 0;
	for (int i = 0; i < n; i++) {
		if (gr[i].size() == 1) {
			dp(i, l);
			break;
		}
	}
	fl2 = fl;
	
	fl = true;
	for (int i = 0; i < n; i++) used[i] = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (gr[i].size() == 1) {
			dp(i, l);
			break;
		}
	}

	return max(fl, fl2);
}

int main() {
	fastInp;

	cin >> n;

	gr.resize(n);
	for (int i = 0; i < n - 1; i++) {
		ll u, v;
		cin >> u >> v;
		u--; v--;
		gr[u].push_back(v);
		gr[v].push_back(u);
	}

	ll cnt = 0;

	for (int i = 0; i < n; i++) {
		if (gr[i].size() > 2) cnt += (gr[i].size() - 3) / 2 + 1;
	}

	cout << cnt + 1 << " ";

	int l = 0, r = INF;
	while (r - l > 1) {
		int mid = (l + r) / 2;
		if (check(mid)) {
			r = mid;
		}
		else {
			l = mid;
		}
	}

	cout << r - 1;

	return 0;
}