#pragma comment(linker,"/STACK:1024000000,1024000000") #include #include #include #include using namespace std; const int N = 100005; #define LL __int64 struct EDG{ int to,next; }edg[N*2]; int eid,head[N]; int fath[N],deep[N],top[N],num[N],son[N],p[N],pos; void init(){ pos=0; eid=0; memset(head,-1,sizeof(head)); } void addEdg(int u,int v){ edg[eid].to=v; edg[eid].next=head[u]; head[u]=eid++; edg[eid].to=u; edg[eid].next=head[v]; head[v]=eid++; } void dfs(int u,int pre,int d){ fath[u]=pre; num[u]=1; deep[u]=d; son[u]=-1; for(int i=head[u]; i!=-1; i=edg[i].next){ int v=edg[i].to; if(v==pre)continue; dfs(v,u,d+1); num[u]+=num[v]; if(son[u]==-1||num[son[u]]>1; build(l,m,k<<1); build(m+1,r,k<<1|1); root[k]=root[k<<1]^root[k<<1|1]; } void updata(int l,int r,int k,int id,int vule){ if(l==r){ root[k]=vule; return ; } int m=(l+r)>>1; if(id<=m) updata(l,m,k<<1,id,vule); else updata(m+1,r,k<<1|1,id,vule); root[k]=root[k<<1]^root[k<<1|1]; } int query(int l,int r,int k,int L,int R){ if(L<=l&&r<=R){ return root[k]; } int m=(l+r)>>1 , ans=0; if(L<=m) ans^= query(l,m,k<<1,L,R); if(mdeep[v]) swp(u,v); ans^=query(1,pos,1,p[u],p[v]); return ans; } int main() { int T,n,q,val[N],u,v; scanf("%d",&T); while(T--){ scanf("%d%d",&n,&q); init(); for(int i=1; i