#include<bits/stdc++.h>

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define hell 100000000000000007 //10e18+7
#define mod 1000000007//10e9+7
#define pi  3.141592653589793238
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define range(a,b)    substr(a,b-a+1)
#define w(x)            int x; cin>>x; while(x--)
#define trace(x)    cerr<<#x<<": "<<x<<" "<<endl;
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
int arr[300002];
int segtree[4 * 300002 + 1];
// int mod_exp(int x, int y, int mm)
// {
//   x %= mm;
//   if (y == 0)
//     return (1);
//   else if (y % 2 == 0)
//     return (mod_exp((x * x) % mm, y / 2, mm));
//   else
//     return ((x * mod_exp((x * x) % mm, (y - 1) / 2, mm)) % mm);
// }
// int modInverse(int n, int p)
// {
//   return mod_exp(n, p - 2, p);
// }
//remember the approach of suming up the element
// and when it exceeds from our radar
// try removing from the staring part
//priority queue max heap imp!!
void buildSegtree(int s1, int e1, int p1)
{
  if (s1 == e1)
  {
    segtree[p1] = (arr[s1]);
    return;
  }
  int mid = ((s1 + e1) / 2);
  buildSegtree(s1, mid, 2 * p1 + 1);
  buildSegtree(mid + 1, e1, 2 * p1 + 2);
  segtree[p1] = ((segtree[2 * p1 + 1])^segtree[2 * p1 + 2]) ;
}

int rangeQuery(int q1, int q2, int s1, int e1, int p1)
{
  if (q1 <= s1 && q2 >= e1)
    return (segtree[p1]);
  if (q2 < s1 || q1 > e1)
    return (0);//it varies BE CAREFUint!!
  int mid = (s1 + e1) / 2;
  int l1 = rangeQuery(q1, q2, s1, mid, 2 * p1 + 1);
  int l2 = rangeQuery(q1, q2, mid + 1, e1, 2 * p1 + 2);
  return ((l1 ^ l2));
}
void updateQuery(int q1, int q2, int id, int p1, int val)
{
  if (q1 == q2)
  {
    segtree[p1] = segtree[p1] ^ val;
    return;
  }
  int mid = (q1 + q2) / 2;
  if (id > mid)
    updateQuery(mid + 1, q2, id, 2 * p1 + 2, val);
  else
    updateQuery(q1, mid, id, 2 * p1 + 1, val);
  segtree[p1] = (segtree[2 * p1 + 1] ^ segtree[2 * p1 + 2]);
}
// int binpow(int a, int b, int m)
// {
//   a %= m;
//   int res = 1;
//   while (b > 0) {
//     if (b & 1)
//       res = res * a % m;
//     a = a * a % m;
//     b >>= 1;
//   }
//   return res;
// }
// int inv(int a) {
//   a %= mod;
//   if (a < 0) a += mod;
//   int b = mod, u = 0, v = 1;
//   while (a) {
//     int t = b / a;
//     b -= t * a; swap(a, b);
//     u -= t * v; swap(u, v);
//   }
//   if (u < 0) u += mod;
//   return u;
// }

int32_t main()
{
#ifndef ONLINE_JUDGE
  freopen("i1.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    cin >> arr[i];
  buildSegtree(0, n - 1, 0);
  while (m--)
  {
    int a, b, c;
    cin >> a >> b >> c;

    if (a == 1)
    {
      b--;
      updateQuery(0, n - 1, b, 0, c);
    }
    else if (a == 2)
    {
      b--;
      c--;
      int ans = rangeQuery(b, c, 0, n - 1, 0);
      cout << ans << endl;
    }
  }

}


/*author @dhanush*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost                       \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define pb push_back
#define all(x) x.begin(), x.end()
#define se second
#define fi first
ll MOD = 1e9 + 7;
const ll N = 200000 + 10;
vector<ll>adj[N];
ll sz[N];
ll dp[N];
void dfs(ll n,ll p)
{
  for(auto x:adj[n])
  {
    if(x!=p)
    {
      sz[x]+=sz[n]; 
      dfs(x,n);
      
    }
  }
}
void dfsdp(ll n,ll p)
{ 
  for(auto x:adj[n])
  {
    if(x!=p)
    {
      dp[x]=dp[n]+1;
      dfsdp(x,n);
    }
  }
}
void peace()
{
 ll n;
 cin>>n;
 vector<pair<ll,ll>>v;
 for(int i=1;i<n;i++)
 {
   ll a,b;
   cin>>a>>b;
   v.pb({a,b});
   adj[a].pb(b);
   adj[b].pb(a);
 }
 dfsdp(1,-1);
 ll q;
 cin>>q;
 while(q--)
 {
   ll t,e,x;
   cin>>t>>e>>x;
   ll nxt=v[e-1].se;
   ll par=v[e-1].fi;
   if(dp[par]>dp[nxt])
   {
     swap(par,nxt);
     t^=3;
   }
   if(t==1)
   {
     sz[1]+=x;
      sz[nxt]-=x;
   }
   else
   {
     //de
     sz[nxt]+=x;
   }
   
 }
 dfs(1,-1);
 for(int i=1;i<=n;i++)
 {
   cout<<sz[i]<<endl;
 }
}
int main()
{
  boost;
  ll t;
  t = 1;
  //----------
  // cin >> t;
  //----------
  while (t--)
    peace();
}
