/*
*/
 
 
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define ld double
#define pb push_back
#define eb emplace_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--) 
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<double>	vd;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
#define br "\n"
#define ff first
#define ss second
#define debug(a...) cout<<#a<<": ";for(auto it:a)cout<<it<<" ";cout<<endl;
ll MAX = 2e6 + 1;
ll mod = 1e9 + 7;

vector<vll> g;
vll in,out,dis;
ll cnt = 0;
vector<vll> edge;
vll tree,lazy;

void dfs(ll u,ll v){
    dis.pb(u);
    in[u] = cnt;
    cnt++;
    for(auto &x:g[u]){
        if(x == v) continue;
        dfs(x,u);
    }
    out[u] = cnt - 1;
}

bool parent(ll u,ll v){
    if(in[u] <= in[v] && out[u] >= out[v]) return true;
    return false;
}

ll range(ll v,ll tl,ll tr,ll l,ll r){
    if(lazy[v] > 0){
        tree[v] += lazy[v];
        lazy[2*v] += lazy[v];
        lazy[2*v + 1] += lazy[v];
        lazy[v] = 0;
    }
    if(tl == l && tr == r) return tree[v];
    if(l > r) return 0;
    ll tm = (tl + tr)/2;
    return (range(2*v,tl,tm,l,min(r,tm)) + range(2*v + 1,tm + 1,tr,max(l,tm + 1),r));
}

void update(ll v,ll tl,ll tr,ll l,ll r,ll val){
    if(lazy[v] > 0){
        tree[v] += lazy[v];
        lazy[2*v] += lazy[v];
        lazy[2*v + 1] += lazy[v];
        lazy[v] = 0;
    }
    if(l > r) return;

    if(l == tl && r == tr){
        tree[v] += val;
        lazy[2*v] += val;
        lazy[2*v + 1] += val;
        return;
    }
    ll tm = (tl + tr)/2;
    update(2*v,tl,tm,l,min(tm,r),val);
    update(2*v + 1,tm + 1,tr,max(l,tm + 1),r,val);
    tree[v] = tree[2*v] + tree[2*v + 1];

}
 
void solve(){
    ll n;
    cin >> n;
    g.resize(n);
    in.resize(n);
    out.resize(n);
    rep(i,0,n - 1){
        ll a,b;
        cin >> a >> b;a--,b--;
        g[a].pb(b);
        g[b].pb(a);
        edge.pb({a,b});
    }
    dfs(0,0);
    tree.resize(4*n);
    lazy.resize(8*n);
    ll q;
    cin >> q;
    vll ans(n);
    rep(i,0,q){
        ll t,e,c;
        cin >> t >> e >> c;e--;
        ll a,b;
        a = edge[e][0];
        b = edge[e][1];
        if(t == 2){
            swap(a,b);
        }
        if(parent(b,a)){
            ll l = in[a],r = out[a];
            update(1,0,n - 1,l,r,c);
        }
        else{
            ll l = in[b],r = out[b];
            update(1,0,n - 1,0,n - 1,c);
            update(1,0,n - 1,l,r,-1*c);
        }

    }
    rep(i,0,n){
        ans[dis[i]] = range(1,0,n - 1,i,i);
    }
    for(auto &x:ans) cout << x << br;
}
 
 
int main(){ 
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
    
	ll t = 1;
    // calc();
    // cin >> t;
    // calc();
	rep(i,0,t){
        // cout << "Case #" << i + 1 << ": ";
        solve();
        // test();
	}
}
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
using ll=long long;
using namespace std;
using pii = pair<int,int>;


int main(){
    int N,Q;
    cin>>N;
    vector<pii> E;
    vector<vector<int>> G(N);
    int u,v;
    for(int i=0;i<N-1;i++){
        cin>>u>>v;
        u--;v--;
        G[u].push_back(v);
        G[v].push_back(u);
        E.push_back({u,v});
    }
    set<pii> S;
    queue<int> q;
    vector<int> check(N,0);
    check[0]=1;
    q.push(0);
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(auto p:G[v]){
            if(check[p]){continue;}
            check[p]=1;
            S.insert({v,p});
            q.push(p);
        }
    }

    /*
    cout<<"E"<<endl;
    for(auto p:E){
        cout<<p.first<<" "<<p.second<<endl;
    }
    cout<<"S"<<endl;
    for(auto p:S){
        cout<<p.first<<" "<<p.second<<endl;
    }
    //*/
    vector<ll> V(N,0);
    cin>>Q;
    int t,e;
    ll x;
    for(int i=0;i<Q;i++){
        cin>>t>>e>>x;
        e--;
        if(t == 1){
            if(S.find(E[e])!=S.end()){
                //cout<<"u->v"<<endl;
                V[0]+=x;
                V[E[e].second]-=x;
            }else{
                //cout<<"v->u"<<endl;
                V[E[e].first]+=x;
            }
        }else{
            if(S.find(E[e])!=S.end()){
                //cout<<"v->u"<<endl;
                V[E[e].second]+=x;
            }else{
                //cout<<"u->v"<<endl;
                V[0]+=x;
                V[E[e].first]-=x;
            }
        }
    }
    /*
    for(auto p:V){
        cout<<p<<" ";
    }
    cout<<endl;
    //*/

    check=vector<int> (N,0);
    check[0]=1;
    q.push(0);
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(auto p:G[v]){
            if(check[p]){continue;}
            check[p]=1;
            V[p]+=V[v];
            q.push(p);
        }
    }
    for(auto p:V){
        cout<<p<<endl;
    }


    return 0;
}