#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n; vector > G(n); for(Int i=1;i>x>>y; x--;y--; G[x].emplace_back(y); G[y].emplace_back(x); } vector dep(n); Int s=0; function dfs= [&](Int v,Int p,Int d){ dep[v]=d; for(Int u:G[v]){ if(u==p) continue; dfs(u,v,d+1); } if(dep[s]