#include #include using namespace std; using namespace atcoder; using graph = vector>; int op(int a, int b) { return a ^ b; } int e() { return 0; } void tour(const graph &to, vector &route, int v, int p) { route.push_back(v); for (auto &&c : to.at(v)) { if (c == p) { continue; } tour(to, route, c, v); } route.push_back(v); } int main() { int n, q; cin >> n >> q; vector c(n); for (int i = 0; i < n; i++) { cin >> c.at(i); } graph to(n); for (int i = 0; i < n - 1; i++) { int a, b; cin >> a >> b; a--; b--; to.at(a).push_back(b); to.at(b).push_back(a); } vector route; tour(to, route, 0, -1); assert(int(route.size()) == 2 * n); vector idx0(n, -1), idx1(n, -1); for (int i = 0; i < 2 * n; i++) { int v = route.at(i); if (idx0.at(v) == -1) { idx0.at(v) = i; } else { assert(idx1.at(v) == -1); idx1.at(v) = i; } } segtree seg(2 * n); for (int i = 0; i < n; i++) { seg.set(idx0.at(i), c.at(i)); } for (int i = 0; i < q; i++) { int t, x, y; cin >> t >> x >> y; x--; if (t == 1) { seg.set(idx0.at(x), seg.get(idx0.at(x)) ^ y); } else { cout << seg.prod(idx0.at(x), idx1.at(x)) << '\n'; } } return 0; }