class segment_tree: __slots__ = ["op_M", "e_M","N","N0","dat"] def __init__(self, N, operator_M, e_M): self.op_M = operator_M self.e_M = e_M self.N = N self.N0 = 1<<(N-1).bit_length() self.dat = [self.e_M]*(2*self.N0) # 長さNの配列 initial で初期化 def build(self, initial): assert self.N == len(initial) self.dat[self.N0:self.N0+len(initial)] = initial[:] for k in range(self.N0-1,0,-1): self.dat[k] = self.op_M(self.dat[2*k], self.dat[2*k+1]) # a_k の値を x に更新 def update(self,k,x): k += self.N0 self.dat[k] = x k >>= 1 while k: self.dat[k] = self.op_M(self.dat[2*k], self.dat[2*k+1]) k >>= 1 # 区間[L,R]をopでまとめる def query(self,L,R): L += self.N0; R += self.N0 + 1 sl = sr = self.e_M while L < R: if R & 1: R -= 1 sr = self.op_M(self.dat[R],sr) if L & 1: sl = self.op_M(sl,self.dat[L]) L += 1 L >>= 1; R >>= 1 return self.op_M(sl,sr) def get(self, k): #k番目の値を取得。query[k,k]と同じ return self.dat[k+self.N0] def Euler_tour_vertex(g,root): n = len(g) parent = [-1]*n ls = [0]*n rs = [-1]*n q = [root] order = [] for cnt in range(n): v = q.pop() order.append(v) ls[v] = cnt for c in g[v]: if c != parent[v]: parent[c] = v q.append(c) for i in order[n:0:-1]: if rs[i] == -1: rs[i] = ls[i]+1 if rs[parent[i]] < rs[i]: rs[parent[i]] = rs[i] return ls,rs,order import sys readline = sys.stdin.readline n,Q = map(int,readline().split()) *C, = map(int,readline().split()) g = [[] for _ in range(n)] for i in range(n-1): a,b = map(int,readline().split()) g[a-1].append(b-1) g[b-1].append(a-1) ls,rs,order = Euler_tour_vertex(g,0) cost = [0]*n pos = [0]*n for i in range(n): cost[i] = C[order[i]] pos[order[i]] = i seg = segment_tree(n, lambda x,y:x^y, 0) seg.build(cost) #v の部分木に属する頂点は [ls[v],rs[v]) までの頂点 for _ in range(Q): t,x,y = map(int,readline().split()) x -= 1 p = pos[x] if t==1: seg.update(p,seg.get(p)^y) else: ans = seg.query(ls[x],rs[x]-1) print(ans)