#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
mt19937_64 rng(73982);
vector<vector<int> > adjLis;
int prefxor;
bool trav(int x, int p = -1) {
  if (adjLis[x].size() == 1 && prefxor != 0) {
    return false;
  }
  for (int y : adjLis[x]) {
    if (y == p) continue;
    prefxor ^= 1;
    if (!trav(y, x)) return false;
    prefxor ^= 1;
  }
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  adjLis.resize(n);
  int line = true;
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    adjLis[a].push_back(b);
    adjLis[b].push_back(a);
    if (adjLis[a].size() > 2) line = false;
    if (adjLis[b].size() > 2) line = false;
  }
  for (int i = 0; i < n; i++) {
    if (adjLis[i].size() == 1) {
      prefxor = 0;
      if (trav(i)) {
        printf("1 ");
      } else {
        printf("3 ");
      }
      break;
    }
  }
  map<pair<int, int>, long long> values;
  for (int i = 0; i < n; i++) {
    if (adjLis[i].size() != 1) {
      long long val = rng();
      for (int j : adjLis[i]) {
        if (i < j) {
          values[make_pair(i, j)] ^= val;
        } else {
          values[make_pair(j, i)] ^= val;
        }
      }
    }
  }
  set<long long> ans;
  for (auto i : values) {
    ans.insert(i.second);
  }
  printf("%lu\n", ans.size());
}
