#include //#include //#include using namespace std; //using namespace atcoder; //using namespace boost::multiprecision; #define fs first #define sc second #define pb push_back #define mp make_pair #define eb emplace_back #define ALL(A) A.begin(),A.end() #define RALL(A) A.rbegin(),A.rend() typedef long long ll; typedef pair P; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template T gcd(T a,T b){return b?gcd(b,a%b):a;} const ll mod=1e9 + 7; const ll LINF=1ll<<60; const int INF=1<<30; //int dx[]={0,1,0,-1,0,1,-1,1,-1}; //int dy[]={0,0,1,0,-1,1,-1,-1,1}; int dx[]={0,0,1,-1}; int dy[]={-1,1,0,0}; vector> g(1<<17); //グラフの隣接リスト vector v; //オイラーツアーの頂点配列 vector ind(1<<17), out(1<<17); //各頂点がオイラーツアー配列の何番目に最初に訪れるか void dfs(int now, int par){//今の頂点、親の頂点 ind[now] = v.size(); v.push_back(now); for(int i = 0; i < g[now].size(); i++){ if(g[now][i] != par){ dfs(g[now][i],now); v.push_back(now); } } out[now] = v.size(); } template struct SegmentTree{ using F = function; int n; F f; T ti; vector dat; SegmentTree(){}; SegmentTree(F f,T ti):f(f),ti(ti){} void init(int n_){ n=1; while(n &v){ int n_=v.size(); init(n_); for(int i=0;i>=1) dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]); } T query(int a,int b){ T vl=ti,vr=ti; for(int l=a+n,r=b+n;l>=1,r>>=1) { if(l&1) vl=f(vl,dat[l++]); if(r&1) vr=f(dat[--r],vr); } return f(vl,vr); } }; int main(){ int n,q;cin >> n >> q; vector c(n); for (int i = 0; i < n; i++) { cin >> c[i]; } for (int i = 0; i < n-1; i++) { int x,y;cin >> x >> y; x--,y--; g[x].pb(y); g[y].pb(x); } dfs(0, 0); SegmentTree seg([](ll a, ll b){ return a ^ b; }, 0ll); seg.build(vector (2 * n, 0)); for (int i = 0; i < n; i++) { seg.set_val(ind[i], c[i]); } while(q--){ int t,x,y;cin >> t >> x >> y; x--; if(t == 1){ ll t = seg.query(ind[x], ind[x] + 1); seg.set_val(ind[x], t ^ y); } else{ cout << seg.query(ind[x], out[x] + 1) << endl; } } return 0; }