#include <bits/stdc++.h>

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 1e18;
//const ll MOD = 1000000007;
const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair
  
vii G(100010);
int root;


int dfs(int now, int par, int& leaf, int max_len) {
  vi child_len;
  rep (i, G[now].size()) {
    int child = G[now][i];
    if (child == par) continue;
    int len = dfs(child, now, leaf, max_len);
    if (len == -1) return -1;
    child_len.push_back(len);
  }
  if (child_len.size() == 0) {
    leaf++;
    return 1;
  }
  if (child_len.size() % 2 == 0) {
    leaf++;
    child_len.push_back(0);
  }    
  sort(all(child_len));
  multiset<int> st;
  rep (i, child_len.size()) {
    st.insert(-child_len[i]);
  }
  int safe = 1;
  int temp;
  rrep (i, child_len.size()) {
    if (!st.count(-child_len[i])) continue;
    int len1 = child_len[i];
    auto itr = st.lower_bound(-len1);
    st.erase(itr);
    itr = st.lower_bound(-(max_len - len1));
    if (itr != st.end()) {
      int len2 = -*itr;
      st.erase(itr);
    }
    else {
      safe--;
      temp = len1;
      if (safe < 0) return -1;
    }
  }
  if (now != root) {
    if (temp + 1 <= max_len) {
      return temp + 1;
    }
    else {
      return -1;
    }
  }
  else {
    if (temp <= max_len) {
      return temp;
    }
    else {
      return -1;
    }
  }
}

int check(int root, int max_len) {
  int leaf = 0;
  int res = dfs(root, -1, leaf, max_len);
  if (res < 0) return -1;
  else return (leaf + 1) / 2;
}

int main() {
  int n;
  cin >> n;
  rep (i, n - 1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  rep (i, n) {
    if (G[i].size() == 1) {
      root = i;
      break;
    }
  }
  int ng = 0, ok = 2*n, a = 10;
  while (ng + 1 < ok) {
    int mid = (ng + ok) / 2;
    int res = check(root, mid);
    if (res == -1) {
      ng = mid;
    }
    else {
      a = res;
      ok = mid;
    }
  }
  cout << a << " " << ok << endl;
}


Measured memory_bytes: 21376