#include<bits/stdc++.h>
using namespace std;
int n,p,q;
int f[105],dep[105],tot[105];
int maxx,MAX,ans;
int main()
{
cin>>n;
for(int i=1;i<n;i++)
{
cin>>p>>q;
f[q]=p;
tot[dep[q]=dep[p]+1]++;
maxx=maxx<dep[q]?dep[q]:maxx;
MAX=MAX<tot[dep[q]]?tot[dep[q]]:MAX;
}
cin>>p>>q;
if(dep[p]<dep[q])
{
while(dep[p]!=dep[q])
{
q=f[q],ans++;
}
}
if(dep[p]>dep[q])
{
while(dep[p]!=dep[q])
{
p=f[p];
ans+=2;
}
}
while(p!=q)
{
p=f[p];
q=f[q];
ans+=3;
}
cout<<maxx+1<<endl<<MAX<<endl<<ans;
}