#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

struct edge{
        int to;
        ll cost;
        edge(){}
        edge(int a, ll b) : to(a), cost(b){}
    };
using ve = vector<edge>;

void bfs(vec &a, vec &b, vec &dist){
    mat G(N);
    rep(i, N - 1) {
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    dist[0] = 0;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(int to : G[v]){
            if(dist[to] == INF){
                dist[to] = dist[v] + 1;
                que.push(to);
            }
        }
    }
}

void dfs(int p, int v, vec &a, vec &b, vec &c, vector<ve> &G, ll &res, vec &cv){
    if(p != -1) cv[v] += cv[p];
    for(edge e : G[v]){
        if(e.to != p){
            cv[e.to] += e.cost;
            dfs(v, e.to, a, b, c, G, res, cv);
        }
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>N;
    vector<ve> G(N);
    vec a(N-1), b(N-1), c(N-1, 0), cv(N, 0), dist(N, INF);
    rep(i, N - 1){
        cin>>a[i]>>b[i];
        --a[i]; --b[i];
    }
    bfs(a, b, dist);
    cin>>Q;
    ll res = 0;
    rep(_, Q){
        int t, e, x;
        cin>>t>>e>>x;
        --e;
        if(dist[a[e]] > dist[b[e]]) t = 3 - t;
        if(t == 1){
            res += x;
            c[e] -= x;
        }else{
            c[e] += x;
        }
    }
    rep(i, N - 1) if(dist[a[i]] > dist[b[i]]) swap(a[i], b[i]);
    rep(i, N - 1){
        G[a[i]].emplace_back(b[i], c[i]);
        G[b[i]].emplace_back(a[i], 0);
    }
    dfs(-1, 0, a, b, c, G, res, cv);
    rep(i, N){
        cout<<res + cv[i]<<endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int parent[200005],a[200005],b[200005];
ll prop[200005];
vector<int>edges[200005];

void dfs(int u,int p)
{
    parent[u] = p;
    for(int v:edges[u])
    {
        if(v==p) continue;
        dfs(v,u);
    }
    return ;
}
void dfs2(int u,int p)
{
    prop[u] += prop[p];
    for(int v:edges[u])
    {
        if(v==p) continue;
        dfs2(v,u);
    }
    return ;
}

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

    int n,i,j,u,v,t;
    ll w;
    cin >> n;
    for(i=1;i<n;i++)
    {
        cin >> u >> v;
        a[i] = u;
        b[i] = v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    dfs(1,0);

    int q;
    cin >> q;

    while(q--)
    {
        cin >> t >> i >> w;
        if(t==1)
        {
            u = a[i];
            v = b[i];
        }
        else
        {
            u = b[i];
            v = a[i];
        }
        if(u==parent[v])
        {
            prop[1] += w;
            prop[v] -= w;
        }
        else
            prop[u] += w;
    }
    dfs2(1,0);
    for(i=1;i<=n;i++)
        cout << prop[i] << endl;
}
