#define lep(i, l, r) for(int i = (l); i <= (r); i ++) #define rep(i, l, r) for(int i = (l); i >= (r); i --) #define debug(...) fprintf (stderr, __VA_ARGS__)
using std :: cin; using std :: cout; using std :: endl; using std :: cerr; using i64 = longlong;
constint P = 998244353; inlineintmod(int x){ return x + (x >> 31 & P); } inlinevoidsub(int &x, int y){ x = mod(x - y); } inlinevoidpls(int &x, int y){ x = mod(x + y - P); } inlineintadd(int x, int y){ returnmod(x + y - P); } inlineintdec(int x, int y){ returnmod(x - y); } inlineintpower(int x, int k){ int res = 1; if (k < 0) k += P - 1; while (k) { if (k & 1) res = 1ll * res * x % P; x = 1ll * x * x % P; k >>= 1; } return res; }
constint N = 2e5 + 5;
int n; std :: vector<int> e[N]; int sz[N], rt, all, vis[N];
voidfindrt(int x, int fx){ sz[x] = 1; int mx = 0; for (int y : e[x]) if (y != fx && ! vis[y]) { findrt (y, x); sz[x] += sz[y]; if (sz[y] > mx) mx = sz[y]; } mx = std :: max (mx, all - sz[x]); if (mx * 2 <= all) rt = x; }