#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

struct Edge{
    int to,id;
    ll dist;
    Edge(int to,ll dist=1,int id=0):to(to),dist(dist),id(id){}
};


#include <functional>

template< typename T, typename S >
struct LazySegmentTree{
    int n;
    vector<T> data;
    vector<S> lazy;
    T te;
    S se;

    inline void merge_functions(S& lazy,S& val){
        lazy+=val;
        //lazy=val;
    }
    inline void operate(T& data,S& val,int len){
        data+=val*len;
        //data=val*len;
        //data+=val;
        //data=val;
    }
    inline T merge_values(T& x,T& y){
        return x+y;
        //return min(x,y);
        //return max(x,y);
    }

    LazySegmentTree(){}
    LazySegmentTree(int sz,T te,S se):te(te),se(se){
        n=1;
        while(n<sz) n*=2;
        data.resize(2*n-1,te);
        lazy.resize(2*n-1,se);
    }

    void build(const vector<T> &A){
        for(int k=0;k<int(A.size());k++) data[k+n-1]=A[k];
        for(int k=n-2;k>=0;k--) data[k]=merge_values(data[2*k+1],data[2*k+2]);
    }

    void eval(int k,int l,int r){
        if(lazy[k]==se) return;
        operate(data[k],lazy[k],r-l);
        if(r-l>1){
            merge_functions(lazy[2*k+1],lazy[k]);
            merge_functions(lazy[2*k+2],lazy[k]);
        }
        lazy[k]=se;
    }

    void update(int a,int b,S val,int k=0,int l=0,int r=-1){
        if(r<0) r=n;
        eval(k,l,r);
        if(b<=l||r<=a) return;
        if(a<=l&&r<=b){
            merge_functions(lazy[k],val);
            eval(k,l,r);
        }else{
            update(a,b,val,2*k+1,l,(l+r)/2);
            update(a,b,val,2*k+2,(l+r)/2,r);
            data[k]=merge_values(data[2*k+1],data[2*k+2]);
        }
    }

    T query(int a,int b,int k=0,int l=0,int r=-1){
        if(r<0) r=n;
        eval(k,l,r);
        if(b<=l||r<=a) return te;
        if(a<=l&&r<=b) return data[k];

        T vl=query(a,b,2*k+1,l,(l+r)/2);
        T vr=query(a,b,2*k+2,(l+r)/2,r);
        return merge_values(vl,vr);
    }

    T get(int p){
        return query(p,p+1);
    }
};

/*
  LazySegmentTree<ll,ll> seg(N,te,se);
  vector<ll> init(N,0);
  seg.build(init);
*/

vector<int> in,out;
vector<int> dep;

void dfs(int now,int par,int &cnt,vector<vector<Edge>> &g,int d){
  in[now]=cnt++;
  dep[now]=d;
  for(auto e:g[now]){
    int nex=e.to;
    if(nex==par) continue;
    dfs(nex,now,cnt,g,d+1);
  }
  out[now]=cnt;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin>>N;
  vector<int> A(N-1),B(N-1);
  rep(i,N-1) cin>>A[i]>>B[i];
  rep(i,N-1){
    A[i]--;B[i]--;
  }

  vector<vector<Edge>> g(N);
  rep(i,N-1){
    g[A[i]].emplace_back(Edge{B[i],1,i});
    g[B[i]].emplace_back(Edge{A[i],1,i});
  }

  LazySegmentTree<ll,ll> seg(N,0,0);
  seg.build(vector<ll> (N,0));
  int cnt=0;
  in.resize(N,0);
  out.resize(N,0);
  dep.resize(N,0);
  dfs(0,-1,cnt,g,0);

  int Q;
  cin>>Q;
  rep(q,Q){
    int T,E;
    ll X;
    cin>>T>>E>>X;
    E--;
    int a=A[E];
    int b=B[E];
    if(T==2) swap(a,b);
    if(true){
      if(dep[a]<dep[b]){
        seg.update(0,in[b],X);
        seg.update(out[b],N,X);
      }else{
        seg.update(in[a],out[a],X);
      }
    }/*else{
      if(hld.dep[a]<hld.dep[b]){
        seg.update(in[b],out[b],X);
      }else{
        seg.update(0,in[a],X);
        seg.update(out[a],N,X);
      }
    }*/
  }

  vector<ll> C(N);
  rep(i,N) C[i]=seg.query(in[i],in[i]+1);
  rep(i,N) cout<<C[i]<<"\n";


  return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
typedef long long int ll;
vector<ll> v[200000+5],par(200000+5),val(200000+5,0);
ll vis1[200000+5]={0};
ll vis[200000+5]={0};
void pdfs(int p){
    vis1[p]=1;
    for(auto i:v[p]){
        if(vis1[i]==0){
            par[i]=p;
            pdfs(i);
        }
    }
}
void vdfs(int p){
    vis[p]=1;
    for(auto i:v[p]){
        if(vis[i]==0){
            val[i]+=val[p];
            vdfs(i);
        }
    }
}

int main()
{
    ll n;cin>>n;
    vector<pair<ll,ll>> v0;
    for(int i=1;i<n;i++){
        ll a,b;cin>>a>>b;
        v0.pb(mp(a,b));
        v[a].pb(b);
        v[b].pb(a);
    }
    pdfs(1);
    par[1]=0;
    ll q;cin>>q;
    while(q--){
        ll t,e,x;cin>>t>>e>>x;
        ll a=v0[e-1].ff;
        ll b=v0[e-1].ss;
        if(a==par[b]){
            if(t==1){
                val[b]-=x;
                val[1]+=x;
            }
            else{
                val[b]+=x;
            }
        }
        else{
            if(t==1){
                val[a]+=x;
            }
            else{
                val[1]+=x;
                val[a]-=x;
            }
        }
    }
    vdfs(1);
    for(int i=1;i<=n;i++){
        cout<<val[i]<<endl;
    }
}