#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;
}

Measured memory_bytes: 30200