#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)

vector <int> dy = {0, 1, 0, -1};
vector <int> dx = {1, 0, -1, 0};

const int INF = 1000000000;
const ll INFLL = 100000000000000000;

int main(){
    int n; cin >> n;
    vector <int> a(n-1), b(n-1);
    vector <vector<int>> G(n);
    rep(i, n-1){
        int _a, _b; cin >> _a >> _b;
        _a--; _b--;
        a.at(i) = _a;
        b.at(i) = _b;
        G.at(_a).push_back(_b);
        G.at(_b).push_back(_a);
    }

    vector <vector<int>> tree(n);
    map<pair<int, int>, int> Tree;
    deque <int> d; d.push_back(0);
    vector <int> seen(n, -1); seen.at(0) = 1;
    while(d.size()){
        auto now = d.front();
        d.pop_front();
        for(auto next: G.at(now)){
            if(seen.at(next) != -1) continue;
            seen.at(next) = 1;
            tree.at(now).push_back(next);
            Tree[make_pair(now, next)] = 1;
            d.push_back(next);
        }
    }

    // for(int i = 0; i < n; i ++){
    //     cout << i << ": ";
    //     for(auto v: tree.at(i)){
    //         cout << v << " ";
    //     }
    //     cout << endl;
    // }

    vector <ll> w(n);
    int q; cin >> q;
    while(q--){
        int t; cin >> t;
        ll e, x; cin >> e >> x;
        e --;
        int v_a, v_b;
        v_a = a.at(e);
        v_b = b.at(e);

        int from, not_to;
        if(t == 1){
            from = v_a;
            not_to = v_b;
        }
        else if(t == 2){
            from = v_b;
            not_to = v_a;
        }

        if(Tree[make_pair(from, not_to)] == 1){
            w.at(0) += x;
            w.at(not_to) += -x;
        }
        else{
            w.at(from) += x;
        }
    }
    deque <int> d2; d2.push_back(0);
    vector <int> seen2(n, -1); seen2.at(0) = 1;
    while(d2.size()){
        auto now = d2.front();
        d2.pop_front();
        for(auto next: G.at(now)){
            if(seen2.at(next) != -1) continue;
            seen2.at(next) = 1;
            d2.push_back(next);

            w.at(next) += w.at(now);
        }
    }

    for(auto ans: w){
        cout << ans << endl;
    }

}
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define rng(i,l,r) for (int i=l; i<r; i++)
#define V(t) vector<t>
#define VV(t) V(vector<t>)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
template<class T> bool chmin(T& a, T b){ if (a > b){ a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b){ if (a < b){ a = b; return true; } return false; }

template <typename T>
struct RMQ {
   const T INF = numeric_limits<T>::max();
   int n; // leafs
   vector<T> dat; // tree array
   RMQ(int n_) : n(), dat(n_ * 4, 0) {
      n = 1;
      while (n_ > n) n *= 2;
   }
   void update(int i, T x) {
      i += n - 1;
      dat[i] ^= x;
      while (i > 0) {
         i = (i - 1) / 2; // parent
         dat[i] = (dat[i * 2 + 1] ^ dat[i * 2 + 2]);
      }
   }
   // the minimum element of [a,b)
   T query(int a, int b) { return query_sub(a, b, 0, 0, n); }
   T query_sub(int a, int b, int k, int l, int r) {
      if (r <= a || b <= l) {
         return 0;
      }
      if (a <= l && r <= b) {
         return dat[k];
      } else {
         T vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
         T vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
         return vl ^ vr;
      }
   }
};

int main() {
   int n, q; cin >> n >> q;
   RMQ<int> st(n);
   rep(i,n) {
      int a; cin >> a;
      st.update(i, a);
   }
   // rep(i,6) cout << st.dat[i] << endl;
   rep(_,q) {
      int t,x,y; cin >> t >> x >> y;
      if (t == 1) { //replace
         st.update(x-1, y);
      } else { // x ... y
         cout << st.query(x-1,y) << endl;
      }
   }
}
