#include #include #include #include using namespace std; #define ll long long const ll bit_length=10; ostream& operator<<(ostream& os,vector>& a){ for(int i=0;i<(ll)a.size();i++){ os<>N>>Q; vectorC(N); for(int i=0;i>C.at(i); } vector>d(N); for(int i=0;i>a>>b; d.at(a-1).push_back(b-1); d.at(b-1).push_back(a-1); } //cerr<que; vectorB(N,false); vectordepth(N,0); que.push_back(0); while(!que.empty()){ q=que.back();que.pop_back(); B.at(q)=true; for(ll i:d.at(q)){ if(B.at(i))continue; que.push_back(i); depth.at(i)+=depth.at(q)+1; } } dequedq; vectorcheck(N,false); for(int i=0;i>T>>x>>y; x--; if(T==1){ C.at(x)=C.at(x)^y; }else{ dq.clear(); ans=x; dq.push_back(x); fill(check.begin(),check.end(),false); while(!dq.empty()){ q=dq.back();dq.pop_back(); //cerr<<"now:"<depth.at(q))dq.push_back(j); } } printf("%lld\n",ans^x); } } return 0; }