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 "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;

void Calculate_Depth(vector<vector<int>>&edge, vector<int>&depth, int stnode) {
	depth[stnode] = 0;
	queue<int>Q;
	Q.push(stnode);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (depth[i] > depth[cn] + 1) {
				depth[i] = depth[cn] + 1;
				Q.push(i);
			}
		}
	}
	return;
}

int Search(vector<vector<int>>&edge, vector<int>&dis, int node) {
	int box = 0;
	for (auto i : edge[node]) {
		if (dis[i] < dis[node])continue;
		box += Search(edge, dis, i);
	}
	M += box / 2;
	if (!node&&box%2)M++;
	return 1;
}

int even(multiset<int>ms, int lim) {
	int box = MOD, ret = MOD;
	while (ms.size() > 1) {
		int a = *ms.rbegin();
		if (a > lim) {
			K = 0;
			return ret;
		}
		auto it = ms.upper_bound(lim - a);
		if (it == ms.begin()) {
			if (box != MOD && ret != MOD) {
				K = 0;
				return ret;
			}
			else if (box != MOD) {
				ret = a;
			}
			else {
				box = a;
			}
			ms.erase(prev(ms.end()));
		}
		else {
			ms.erase(prev(it));
			ms.erase(prev(ms.end()));
		}
	}
	ret %= MOD;
	if (ms.size())return *ms.begin();
	return ret;
}

bool even_zero(multiset<int>ms, int lim) {
	while (ms.size()) {
		if (*ms.begin() + *prev(ms.end()) > lim)return false;
		ms.erase(ms.begin());
		ms.erase(prev(ms.end()));
	}
	return true;
}

int odd(multiset<int>ms, int lim) {
	int ret = MOD;
	while (ms.size() > 1) {
		int a = *ms.rbegin();
		auto it = ms.upper_bound(lim - a);
		if (a > lim) {
			K = 0;
			return ret;
		}
		if (it == ms.begin()) {
			if (ret != MOD) {
				K = 0;
				return ret;
			}
			ret = a;
			ms.erase(prev(ms.end()));
		}
		else {
			ms.erase(prev(it));
			ms.erase(prev(ms.end()));
		}
	}
	if(ms.size())return *ms.begin();
	return ret;
}

int Search(vector<vector<int>>&edge, vector<int>&dis, vector<multiset<int>>&num, int node, int lim) {
	for (auto i : edge[node]) {
		if (dis[i] < dis[node])continue;
		num[node].emplace(Search(edge, dis, num, i, lim) + 1);
	}
	//cout << "node " << node << endl;
	//for (auto i : num[node]) {
	//	cout << i << " ";
	//}
	//cout << endl;
	if (num[node].empty()) {
		return 0;
	}
	if (!node&&num[node].size() % 2 == 0) {
		if (even_zero(num[node], lim)) {
			return 0;
		}
		else {
			K = 0;
			return 0;
		}
	}
	if (num[node].size() % 2 == 1) {
		return odd(num[node], lim);
	}
	else {
	//	assert(0);
		return even(num[node], lim);
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<vector<int>>edge(N);
	for (int i = 1; i < N; i++) {
		cin >> L >> R;
		L--, R--;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	vector<int>dis(N,MOD);
	Calculate_Depth(edge, dis, 0);
	Search(edge, dis, 0);
	L = 0, R = N;
	while (R - L > 1) {
		int mid = (R + L) / 2;
	//	cout << L << " " << R << " " << mid << endl;
		vector<multiset<int>>num(N);
		K = 1;
		auto box = Search(edge, dis, num, 0, mid);
		if (box > mid)K = 0;
		if (K)R = mid;
		else L = mid;
	}
	cout << M << " " << R << endl;
}