#include using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 1000000001 struct Data{ vector grundy; set S; set amari; int g; }; template struct rerooting{ T init_value; vector v; vector ans; vector visited; rerooting(vector> &E){ //init_value = iv; v.resize(E.size()); ans.resize(E.size()); visited.resize(E.size(),false); for(int i=0;i> &E,int now,int p){ //v[now] = init_value; for(int i=0;i> &E,int now,int p,int pv){ //cout<>N>>M; vector A(M); for(int i=0;i>A[i]; A[i]--; } vector> E(N,vector()); for(int i=0;i>a>>b; a--;b--; E[a].push_back(b); E[b].push_back(a); } ; rerooting rr(E); int x = 0; for(int i=0;i S; for(int i=0;i