#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define replr(i, l, r) for (int i = (l); i < (r); ++i)
const int mod = 1e9 + 7;
vector<int> T[202020];
ll ans[202020], C[202020];
void rec(int x, ll c, int par) {
    c += C[x];
    for (int to : T[x]) {
        if (to == par)
            continue;
        rec(to, c, x);
    }
    ans[x] = c;
}

int main() {
    int n, q;
    cin >> n;
    vector<int> A(n), B(n), X(n);
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        A[i] = a;
        B[i] = b;
        T[a].push_back(b);
        T[b].push_back(a);
    }
    queue<P> Q;
    Q.push({1, 0});
    while (!Q.empty()) {
        P p = Q.front();
        Q.pop();
        if (X[p.second] > 0)
            continue;
        X[p.second] = p.first;
        for (int to : T[p.second])
            Q.push({p.first + 1, to});
    }

    cin >> q;
    rep(i, q) {
        ll t, e, x;
        cin >> t >> e >> x;
        e--;
        int a = A[e], b = B[e];
        if (X[a] > X[b]) {
            if (t == 1)
                C[a] += x;
            else {
                C[0] += x;
                C[a] -= x;
            }
        } else {
            if (t == 1) {
                C[0] += x;
                C[b] -= x;
            } else
                C[b] += x;
        }
    }
    rec(0, 0, -1);
    rep(i, n) cout << ans[i] << endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
map<ll,vector<ll>>adjlist;
void dfs(ll curr,ll P,vector<ll>&parent){
    parent[curr]=P;
    for(auto i:adjlist[curr]){
        if(i!=P){
            dfs(i,curr,parent);
        }
    }
    return;
}
void Sum(ll rt,ll P,ll val,vector<ll>&ans){
    ans[rt]+=val;
    for(auto i:adjlist[rt]){
        if(i!=P){
            Sum(i,rt,ans[rt],ans);
        }
    }
    return;
}
void solve(){
    ll n;
    cin>>n;
    vector<pair<ll,ll>>edge(n);
    for(ll i=1;i<n;i++){
        ll x,y;
        cin>>x>>y;
        adjlist[x].push_back(y);
        adjlist[y].push_back(x);
        edge[i]={x,y};
    }
    vector<ll>parent(n+1);
    dfs(1,1,parent);
    ll q;
    cin>>q;
    vector<ll>ans(n+1,0);
    for(ll i=0;i<q;i++){
        ll t,e,x;
        cin>>t>>e>>x;
        ll a=edge[e].first;
        ll b=edge[e].second;
        ll p=parent[a];
        if(t==1){
            if(p!=b){
                ans[1]+=x;
                ans[b]-=x;
            }
            else{
                ans[a]+=x;
            }
        }
        else{
            if(p!=b){
                ans[b]+=x;
            }
            else{
                ans[1]+=x;
                ans[a]-=x;
            }
        }
    }
    Sum(1,1,0,ans);
    for(ll i=1;i<=n;i++){
        cout<<ans[i]<<endl;
    }
    return;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}




