#include<bits/stdc++.h>
using namespace std;
struct node { int father,deep; }t[101];
int n,x,y,u,v,ans1=0,ans2=0,udeep=0,vdeep=0,vis[101];
int main() { cin>>n; t[1].deep=1; vis[1]=1;
for(int i=1;i<n;i++) {
cin>>x>>y;
t[y].deep=t[x].deep+1; t[y].father=x;
vis[t[y].deep]++; ans1=max(ans1,t[y].deep);
} cin>>u>>v;
for(int i=1;i<=ans1;i++) ans2=max(ans2,vis[i]);
cout<<ans1<<endl<<ans2<<endl;
if(u==v) {cout<<0; return 0;}
while(t[u].father!=t[v].father){
if(t[u].father==v) {cout<<(udeep+1)*2; return 0;}
if(t[v].father==u) {cout<<vdeep+1; return 0;}
if(t[u].deep>t[v].deep) {udeep++; u=t[u].father;}
else if(t[v].deep>t[u].deep) {vdeep++; v=t[v].father;}
else if(t[v].deep==t[u].deep&&t[u].father!=t[v].father)
{ udeep++;u=t[u].father;vdeep++;v=t[v].father; }
} cout<<(udeep+1)*2+vdeep+1;
return 0;
}
之前好像只有10个测试点,现在11个了……