#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9;   const long long INF = 1e18;   const double eps = 1e-10;   mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count());   template <class T>   inline void upmin(T &x, T y) {     x = x > y ? y : x;   }   template <class T>   inline void upmax(T &x, T y) {     x = x < y ? y : x;   }   const int maxn = 1e5 + 233;   vector<int> G[maxn];   int n;   int col[maxn];   int fa[maxn];   int cnt[maxn];   void dfs(int u, int f) {     for (auto v : G[u]) {       if (v == f) continue;       col[v] = 3 - col[u];       fa[v] = u;       dfs(v, u);     }   }   int deg[maxn];   int main() {     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     cout << fixed << setprecision(10);     cin >> n;     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       G[u].emplace_back(v);       G[v].emplace_back(u);       deg[u]++;       deg[v]++;     }     for (int i = 1; i <= n; i++) {       if (deg[i] > 1) {         col[i] = 1;         dfs(i, 0);         break;       }     }     int f1 = 0, f2 = 0;     for (int i = 1; i <= n; i++) {       if (deg[i] == 1) {         if (col[i] == 1)           f1 = 1;         else           f2 = 1;         cnt[fa[i]]++;       }     }     int mn, mx;     if (f1 && f2)       mn = 3;     else       mn = 1;     mx = n - 1;     for (int i = 1; i <= n; i++) {       if (cnt[i]) mx -= cnt[i] - 1;     }     cout << mn <<     << mx <<   n ;     return 0;   }   