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