#include using namespace std; #define rep(i,n) for (int i = 0; i< (n); ++i) #define repi(i, a, b) for (int i = (a); i < (b); ++i) #define all(x) (x).begin(), (x).end() #define fore(i, a) for(auto &i:a) using ll = long long; #include using namespace atcoder; struct S{ ll value; }; S op(S a, S b){ return S{a.value^b.value}; } S e(){ return S{0}; } struct F{ ll value; }; S mapping(F f, S x){ return S{x.value^f.value}; } F composition(F f, F g){ return F{f.value^g.value}; } F id(){ return F{0}; } int main() { ll n, q; cin >> n >> q; vector c(n); rep(i, n){ cin >> c[i]; } vector> G(n); rep(i, n-1){ ll a, b; cin >> a >> b; a--;b--; G[a].push_back(b); G[b].push_back(a); } vector pre(n), post(n); ll cnt = 0; function dfs = [&](ll x, ll last){ pre[x] = cnt++; fore(to, G[x]){ if(to == last)continue; dfs(to, x); } post[x] = cnt++; }; dfs(0, -1); vector vec(2*n); rep(i, n){ vec[pre[i]] = S{c[i]}; vec[post[i]] = S{0}; } lazy_segtree seg(vec); vector> qs(q); rep(i, q){ ll t, x, y; cin >> t >> x >> y; x--; qs[i] = {t, x, y}; } rep(i, q){ auto[t, x, y] = qs[i]; if(t == 1){ seg.apply(pre[x], F{y}); } else{ cout << seg.prod(pre[x], post[x]).value << endl; } } }