#include #include using namespace std; using namespace atcoder; #define rep(i, n) for (int i=0; i G[100010]; vector tour; int s[100010]; int t[100010]; int c = 0; void euler(int v, int pv) { s[v] = c++; tour.pb(v); for (int nv:G[v]) { if (nv==pv) continue; euler(nv, v); } t[v] = c; } int op(int x, int y) { return x^y;} int e() {return 0;} int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> Q; rep(i, N) cin >> C[i]; rep(i, N-1) { int a, b; cin >> a >> b; G[a-1].pb(b-1); G[b-1].pb(a-1); } euler(0, -1); segtree st(N); rep(i, N) st.set(i, C[tour[i]]); int idx[N]; rep(i, N) idx[tour[i]] = i; while (Q--) { int T, x, y; cin >> T >> x >> y; if (T==1) { st.set(idx[x-1], C[x-1]^y); C[x-1] ^= y; } else { cout << st.prod(s[x-1], t[x-1]) << endl; } } }