def segfunc(x,y): return x^y class SegmentTree(object): def __init__(self, A, dot, unit): n = 1 << (len(A) - 1).bit_length() tree = [unit] * (2 * n) for i, v in enumerate(A): tree[i + n] = v for i in range(n - 1, 0, -1): tree[i] = dot(tree[i << 1], tree[i << 1 | 1]) self._n = n self._tree = tree self._dot = dot self._unit = unit def __getitem__(self, i): return self._tree[i + self._n] def update(self, i, v): i += self._n self._tree[i] = v while i != 1: i >>= 1 self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1]) def add(self, i, v): self.update(i, self[i] + v) def sum(self, l, r): #これで[l,r)から取り出す。 l += self._n r += self._n l_val = r_val = self._unit while l < r: if l & 1: l_val = self._dot(l_val, self._tree[l]) l += 1 if r & 1: r -= 1 r_val = self._dot(self._tree[r], r_val) l >>= 1 r >>= 1 return self._dot(l_val, r_val) def main(): n,Q = map(int,input().split()) C = list(map(int,input().split())) graph = [[] for _ in range(n)] for i in range(n-1): a,b = map(int,input().split()) a -= 1; b -= 1 graph[a].append(b) graph[b].append(a) idx = 0 start = 0 euler = [] left = [-1] * n #初めて出てくる位置。(行き) right = [-1] * n #二回目に出てくる位置。(帰り) depth = [-1] * n par = [-1] * n depth[start] = 0 #根の深さは0 stack = [] stack.append(~start) #帰りがけ用 stack.append(start) #行き用。行きを先に取り出したいので後に追加。 while stack: v = stack.pop() if v >= 0: euler.append(v) if left[v] == -1: left[v] = idx idx += 1 d = depth[v] for u in graph[v]: if par[v] == u: continue par[u] = v depth[u] = d + 1 stack.append(~u) #後で取り出したいのでこちらが先 stack.append(u) else: a = ~v #戻す if right[a] == -1: right[a] = idx #euler.append(a) #idx += 1 #print(euler) #古いINDEXを入れると新しいINDEXが出てくる #print(left) #print(right) NC = [-1]*n; dic = {} #新しいINDEXを入れると古いINDEXが出てくる。 for i in range(n): idx = left[i] dic[idx] = i cval = C[i] NC[idx] = cval #print(NC) Tree = SegmentTree(NC,segfunc,0) for _ in range(Q): t,x,y = map(int,input().split()) x -= 1 #0-index nx = left[x] if t == 1: val = Tree.__getitem__(nx)^y Tree.update(nx,val) else: #ret = [] #for i in range(n): # ret.append(Tree.__getitem__(i)) #print(ret) ans = Tree.sum(left[x],right[x]) print(ans) if __name__ == '__main__': main()