# include # define fir first # define sec second # define mp std::make_pair const int N=100010,INF=0x3f3f3f3f; inline int read(void){ int res,f=1; char c; while((c=getchar())<'0'||c>'9') if(c=='-') f=-1; res=c-48; while((c=getchar())>='0'&&c<='9') res=res*10+c-48; return res*f; } int n; int f[N]; std::vector G[N]; void init(int x,int fa){ f[x]=fa; for(auto y:G[x]) if(y!=fa) init(y,x); return; } std::multiset > S[N]; int ans; // int fmax[N]; // do not consider last step up. void solve(int x){ if(f[x]&&G[x].size()==1){ S[x].insert(mp(1,0)); return; } int id=0; for(auto y:G[x]){ if(y==f[x]) continue; solve(y); if(S[id].size()