#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int n; vector> E; int get(int cv,int turn,int pv = -1){ if(turn==0){ int ret = -Inf32; rep(i,E[cv].size()){ int to =E[cv][i]; if(to==pv)continue; ret = max(ret,get(to,1,cv)+1); } if(ret==-Inf32)ret= 0; return ret; } else{ int ret = Inf32; rep(i,E[cv].size()){ int to =E[cv][i]; if(to==pv)continue; ret = min(ret,get(to,0,cv)+1); } if(ret==Inf32)ret= 0; return ret; } } int main(){ cin>>n; E.resize(n); rep(i,n-1){ int a,b; cin>>a>>b; a--,b--; E[a].push_back(b); E[b].push_back(a); } cout<