import sys input = sys.stdin.buffer.readline class SegmentTree: # SEG木は1-index # Aに関しては0-index def __init__(self, n, ele, func): # Aは0-idx self.n = n self.ele = ele self.func = func self.num = 2 ** ((self.n - 1).bit_length()) self.SEG = [self.ele] * (2 * self.num) def search(self, idx): return self.SEG[idx + self.num] def initialize(self, A): for i in range(self.n): self.SEG[i + self.num] = A[i] for i in range(self.num - 1, 0, -1): self.SEG[i] = self.func(self.SEG[2 * i], self.SEG[2 * i + 1]) # 1点更新 def set(self, idx, val): idx += self.num self.SEG[idx] = val idx //= 2 while idx: self.SEG[idx] = self.func(self.SEG[2 * idx], self.SEG[2 * idx + 1]) idx //= 2 # 区間取得 def query(self, left, right): # 開区間 resleft = self.ele resright = self.ele left += self.num right += self.num while right - left > 0: if left % 2 == 1: resleft = self.func(resleft, self.SEG[left]) left += 1 if right % 2 == 1: right -= 1 resright = self.func(resright, self.SEG[right]) left //= 2 right //= 2 return self.func(resleft, resright) # 初期条件 def func(a, b): return a ^ b ele = 0 n, q = map(int, input().split()) C = list(map(int, input().split())) graph = [[] for _ in range(n)] for _ in range(n - 1): a, b = map(int, input().split()) a, b = a - 1, b - 1 graph[a].append(b) graph[b].append(a) idx = 0 # graph and n is necessary def dfs(start): global idx par = [-1] * n depth = [-1] * n size = [0] * n stack = [] stack.append(~start) stack.append(start) depth[start] = 0 left = [-1] * n right = [-1] * n euler = [] while stack: v = stack.pop() if v >= 0: d = depth[v] left[v] = idx idx += 1 euler.append(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 right[a] = idx size[a] = 1 for u in graph[a]: if u == par[a]: continue size[a] += size[u] return left, right, euler left, right, euler = dfs(0) moto = [C[i] for i in euler] ST = SegmentTree(n, ele, func) ST.initialize(moto) for _ in range(q): t, x, y = map(int, input().split()) x -= 1 if t == 1: v = ST.search(x) ST.set(left[x], v ^ y) else: print(ST.query(left[x], right[x]))