using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, q) = (c[0], c[1]); c = NList; var map = NArr(n - 1); var query = NArr(q); var tree = new List[n]; for (var i = 0; i < tree.Length; ++i) tree[i] = new List(); foreach (var edge in map) { tree[edge[0] - 1].Add(edge[1] - 1); tree[edge[1] - 1].Add(edge[0] - 1); } var left = new int[n]; var right = new int[n]; var pos = 0; DFS(-1, 0, ref pos, tree, left, right); var seg = new SegmentTree(n * 2, new SegOp()); for (var i = 0; i < n; ++i) seg[left[i]] = c[i]; var ans = new List(); foreach (var que in query) { if (que[0] == 1) { seg[left[que[1] - 1]] ^= que[2]; } else { ans.Add(seg.Prod(left[que[1] - 1], right[que[1] - 1])); } } WriteLine(string.Join("\n", ans)); } static void DFS(int prev, int cur, ref int pos, List[] tree, int[] left, int[] right) { left[cur] = pos++; foreach (var next in tree[cur]) { if (prev == next) continue; DFS(cur, next, ref pos, tree, left, right); } right[cur] = pos++; } struct SegOp : ISegmentTreeOperator { public int Identity => 0; public int Operate(int x, int y) { return x ^ y; } } interface ISegmentTreeOperator { T Identity { get; } T Operate(T x, T y); } class SegmentTree { int _n; int size; int log; T[] d; ISegmentTreeOperator op; void Update(int k) { d[k] = op.Operate(d[2 * k], d[2 * k + 1]); } public SegmentTree(int n, ISegmentTreeOperator op) : this(new T[n], op) {} public SegmentTree(T[] v, ISegmentTreeOperator op) { _n = v.Length; this.op = op; size = 1; while (size < v.Length) size <<= 1; log = CountRZero(size); d = Enumerable.Repeat(op.Identity, 2 * size).ToArray(); for (var i = 0; i < _n; ++i) d[size + i] = v[i]; for (var i = size - 1; i >= 1; --i) Update(i); } int CountRZero(int n) { var ans = 0; while (n % 2 == 0) { ++ans; n >>= 1; } return ans; } public T this[int p] { get { return d[p + size]; } set { p += size; d[p] = value; for (var i = 1; i <= log; ++i) Update(p >> 1); } } public T Prod(int l, int r) { var sml = op.Identity; var smr = op.Identity; l += size; r += size; while (l < r) { if ((l & 1) != 0) sml = op.Operate(sml, d[l++]); if ((r & 1) != 0) smr = op.Operate(d[--r], smr); l >>= 1; r >>= 1; } return op.Operate(sml, smr); } T AllProd() => d[1]; int MinLeft(int r, Predicate f) { if (r == 0) return 0; r += size; T sm = op.Identity; do { r--; while (r > 1 && (r % 2) != 0) r >>= 1; if (!f(op.Operate(d[r], sm))) { while (r < size) { r = 2 * r + 1; if (f(op.Operate(d[r], sm))) { sm = op.Operate(d[r], sm); r--; } } return r + 1 - size; } sm = op.Operate(d[r], sm); } while ((r & -r) != r); return 0; } } }