#include<bits/stdc++.h> 
using namespace std;

#define ll long long int
#define absdiff(a,b) (a>b)?a-b:b-a
#define mp make_pair 
#define pb push_back
#define ff first
#define ss second
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 1000000007 
#define ll_MAX 19223372036859
#define endl "\n"
ll fast_expo(ll x,ll p){
  if(p==0) return 1;
  else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} 
  else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
ll invMod(ll num){
  return fast_expo(num, MOD - 2)%MOD;
}

int main(){
  fast
  #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
  #endif
  
  ll t_c; t_c = 1;
  // cin >> t_c;

  for(ll t_i = 0; t_i < t_c; ++t_i){
    ll n; cin >> n;
    vector<ll> AdjL[n + 1];
    ll a[n], b[n];
    for(ll i = 1; i < n; ++i){
      cin >> a[i] >> b[i];
      AdjL[a[i]].pb(b[i]);
      AdjL[b[i]].pb(a[i]);
    }
    
    ll lev[n + 1], vis[n + 1]{};
    queue<ll> Q;
    Q.push(1);
    vis[1] = lev[1] = 1;
    while(!Q.empty()){
      ll node = Q.front();
      Q.pop();
      for(auto i: AdjL[node]){
        if(!vis[i]){
          vis[i] = 1;
          Q.push(i);
          lev[i] = lev[node] + 1;
        }
      }
    }

    ll c[n + 1]{};
    ll q; cin >> q;
    for(ll i = 1; i <= q; ++i){
      ll t, e, x; cin >> t >> e >> x;
      ll ini = a[e], fin = b[e];
      if(t == 2) swap(ini, fin);

      if(lev[ini] < lev[fin]){
        c[1] += x;
        c[fin] -= x;
      } else {
        c[ini] += x;
      }
    }

    ll ans[n + 1]{};
    fill_n(vis, n + 1, 0);
    Q.push(1);
    vis[1] = 1; ans[1] = c[1];

    while(!Q.empty()){
      ll node = Q.front();
      Q.pop();
      for(auto i: AdjL[node]){
        if(!vis[i]){
          vis[i] = 1;
          Q.push(i);
          ans[i] = ans[node] + c[i];
        }
      }
    }
    
    for(ll i = 1; i <= n; ++i)
      cout << ans[i] << endl;
  } 
  return 0;
}

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P = pair<ll,ll>;
    const int mod=998244353;
    const int INF=1001001001;

    int main() {
      int N;
      cin>>N;
      vector<ll>x(N),y(N);
      rep(i,N){cin>>x[i]>>y[i];}
      int M;
      cin>>M;
      vector<P>b1(M+1),b2(M+1),b3(M+1);
      b3[0]=P(1,0);
      b2[0]=P(0,1);
      rep(i,M){
        int s;
        cin>>s;
        if(s==1){
          b1[i+1]=P(b1[i].second,-b1[i].first);
          b2[i+1]=P(b2[i].second,-b2[i].first);
          b3[i+1]=P(b3[i].second,-b3[i].first);
        }
        else if(s==2){
          b1[i+1]=P(-b1[i].second,b1[i].first);
          b2[i+1]=P(-b2[i].second,b2[i].first);
          b3[i+1]=P(-b3[i].second,b3[i].first);
        }
        else{
          int p;
          cin>>p;
          if(s==3){
            b1[i+1]=P(2*p-b1[i].first,b1[i].second);
            b2[i+1]=P(2*p-b2[i].first,b2[i].second);
            b3[i+1]=P(2*p-b3[i].first,b3[i].second);
          }
          if(s==4){
            b1[i+1]=P(b1[i].first,2*p-b1[i].second);
            b2[i+1]=P(b2[i].first,2*p-b2[i].second);
            b3[i+1]=P(b3[i].first,2*p-b3[i].second);
          }
        }
      }
      int Q;
      cin>>Q;
      rep(i,Q){
        int a,b;
        cin>>a>>b;
        b--;
        ll X=(b3[a].first-b1[a].first)*x[b]+(b2[a].first-b1[a].first)*y[b]+b1[a].first;
        ll Y=(b3[a].second-b1[a].second)*x[b]+(b2[a].second-b1[a].second)*y[b]+b1[a].second;
        cout<<X<<" "<<Y<<endl;
      }
      return 0;
    }