N,Q = map(int,input().split()) C = list(map(int,input().split())) def f(n): return int(n) - 1 ab = [list(map(f,input().split())) for _ in range(N-1)] txy = [list(map(int,input().split())) for _ in range(Q)] e = [[] for _ in range(N)] for i in range(N-1): a,b = ab[i] e[a].append(b) e[b].append(a) sum = [0 for _ in range(N)] d = [[0,0] for _ in range(N)] import sys sys.setrecursionlimit(10**6) l = [0 for _ in range(N)] def euler(n,k): d[n][0] = k l[n] = 1 now = k for i in e[n]: if l[i] == 1: continue qqq = euler(i,now+1) now = qqq d[n][1] = now + 1 return (now + 1) euler(0,0) import math def calcsum(): l = [0 for _ in range(N)] def dfs(n): l[n] = 1 sum[n] = C[n] for i in e[n]: if l[i]: continue s = dfs(i) sum[n] ^= s return sum[n] dfs(0) calcsum() q = math.floor(math.sqrt(Q)) nowq = 0 while True: calcsum() p = True for i in range(q): nq = q * nowq + i if nq >= Q: p = False break t,x,y = txy[nq] if t == 1: continue x -= 1 s = sum[x] for j in range(i): nnq = q * nowq + j nt,nx,ny = txy[nnq] if nt == 2: continue nx -= 1 if d[x][0] <= d[nx][0] <= d[x][1]: s ^= ny print(s) if not p: break for i in range(q): nq = q * nowq + i t,x,y = txy[nq] if t == 2: continue x -= 1 C[x] ^= y nowq += 1