#pragma GCC optimize("Ofast") #pragma GCC target("avx2") char*mmap(); char wbuf[1<<25]; #define rd_skip() while(*rp++>=48) #define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;} #define WTHI(v) {ulong _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;} #define WTLO(v) {ulong _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(ulong*)wp=_d;wp+=8;} #define wt(v) if(v>=100000000){if(v>=10000000000000000l){WTHI(v/10000000000000000l);WTLO(v/100000000);}else WTHI(v/100000000);WTLO(v);}else{WTHI(v);} #define rep(v,e) for(long v=0;v>1]; } return rp; } main(){ char*rp=mmap(0l,1l<<25,1,2,0,0ll); char*wp=wbuf; rp=graph_read(rp); f(1,0,1); fw_build(); rd_skip(); while(*rp){ long w=*rp; rp+=2; rd(x); if(w=='1'){ if(nodes[x].alive){ fw_add(nodes[x].l,del(x)); } } if(w=='2'){ ulong z=0; if(nodes[x].alive){ z^=fw_get(nodes[x].l+1); z^=fw_get(nodes[x].r); } wt(z); *wp++='\n'; } } write(1,wbuf,wp-wbuf); _exit(0); }