import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10**9) class SegmentTree: """ https://qiita.com/dn6049949/items/afa12d5d079f518de368 から拝借しています。 """ def __init__(self, size, f=lambda x, y: x ^ y, default=0): self.size = 2 ** (size - 1).bit_length() self.default = default self.dat = [default] * (self.size * 2) self.f = f def initialize(self, A): for i, a in enumerate(A, self.size): self.dat[i] = a for i in range(self.size - 1, 0, -1): self.dat[i] = self.f(self.dat[i * 2], self.dat[i * 2 + 1]) def update(self, i, x): i += self.size self.dat[i] = x while i > 0: i >>= 1 self.dat[i] = self.f(self.dat[i * 2], self.dat[i * 2 + 1]) def query(self, l, r): """半開区間[l,r)""" l += self.size r += self.size lres, rres = self.default, self.default while l < r: if l & 1: lres = self.f(lres, self.dat[l]) l += 1 if r & 1: r -= 1 rres = self.f(self.dat[r], rres) l >>= 1 r >>= 1 res = self.f(lres, rres) return res def get(self, i): return self.dat[i + self.size] N, Q = map(int, input().split()) C = list(map(int, input().split())) T = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(lambda x: int(x) - 1, input().split()) T[a].append(b) T[b].append(a) # euler tour tour = [] v_in_tour = [[] for _ in range(N)] def dfs(v, p): v_in_tour[v].append(len(tour)) tour.append(v) for u in T[v]: if u == p: continue dfs(u, v) v_in_tour[v].append(len(tour)) tour.append(v) dfs(0, -1) init_c = [0] * (2 * N) for i, c in enumerate(C): init_c[v_in_tour[i][0]] = c # segment tree st = SegmentTree(2 * N) st.initialize(init_c) for _ in range(Q): query = tuple(map(int, input().split())) if query[0] == 1: x = query[1] - 1 y = query[2] st.update(v_in_tour[x][0], st.get(v_in_tour[x][0]) ^ y) elif query[0] == 2: x = query[1] - 1 print(st.query(v_in_tour[x][0], v_in_tour[x][1]))