#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<long long>
#define N 200001
using namespace std;
const int mod = 1e9+7;
//const int mod = 998244353;
class Int
{
public:
ll val;
Int(ll b=0)
{
val = b%mod;
if(val<0) val+=mod;
}
Int& operator+=(Int const &b)
{
val = (val+b.val)%mod;
return *this;
}
Int& operator-=(Int const &b)
{
val = (val-b.val)%mod;
if(val<0) val+=mod;
return *this;
}
Int& operator*=(Int const &b)
{
val = (val*b.val)%mod;
return *this;
}
friend Int Pow(Int a, int b)
{
Int res=1;
while(b)
{
if(b&1) res*=a;
a*=a;
b>>=1;
}
return res;
}
friend Int inv(Int a)
{
return Pow(a,mod-2);
}
friend Int operator+(Int a, Int const b) { return a += b; }
friend Int operator-(Int a, Int const b) { return a -= b; }
friend Int operator-(Int const a) { return 0 - a; }
friend Int operator*(Int a, Int const b) { return a *= b; }
friend bool operator != (Int a, Int b) {return a.val!=b.val;}
friend std::ostream& operator<<(std::ostream& os, Int const& a) {return os << a.val;}
};
Int factor[N];
Int C(int m, int n)
{
if(n>m || n<0) return 0;
if(n==0 || n==m) return 1;
return factor[m]*inv(factor[m-n]*factor[n]);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
vi g[n+1], deg(n+1,0);
vector<bool> vis(n,false);
for(int i=0; i<n-1; i++)
{
int u,v;
cin>>u>>v;
g[u].pb(v);
g[v].pb(u);
deg[u]++, deg[v]++;
}
queue<int> q;
for(int i=1; i<=n; i++)
if(g[i].size()==1) q.push(i);
int remain=n, turn=0;
while(!q.empty())
{
if(remain<=2) break;
int k=q.size();
turn++;
while(k--)
{
int u=q.front();
q.pop();
vis[u] = true;
remain--;
for(auto &v: g[u])
{
if(vis[v]) continue;
if(--deg[v]==1) q.push(v);
}
}
}
int node=q.front();
if(remain==1)
cout<<turn<<' '<<node<<'\n';
else
cout<<turn+1<<' '<<node<<'\n';
/*int T;
cin>>T;
while(T--)
{
}*/
}