 /*
    Auther: ghoshashis545 Ashis Ghosh 😎
    College: Jalpaiguri Govt Enggineering College
*/
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma") 

#include <bits/stdc++.h>
#include<algorithm>
#include<string>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <class type1>
// using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 

#define ll int
#define int long long
#define ld long double
#define ff first
#define ss string 
#define se second
#define sp(x) cout << fixed << setprecision(x)
#define endl "\n"
#define ub upper_bound
#define lb lower_bound
#define vi vector<int>
#define ipair pair<int,int>
#define vpi vector<ipair>
#define clr(a,x) memset(a,x,sizeof(a))
#define alt(v) v.begin(),v.end()
#define ralt(v) v.rbegin(),v.rend()
#define pb emplace_back
#define mp make_pair
#define cntb(x) __builtin_popcount(x)
#define fab(i,a,b) for(int i=(a);i<(b);i++)
#define fba(i,a,b) for(int i=(b);i>=(a);i--)
bool ispoweroftwo(int n){return n&(!(n&(n-1)));}
int mod=1000000007;
// int mod=998244353;
int dx[] = {1,0,-1,0};
int dy[] = {0,-1,0,1};

bool test  = 0;

const int inf = 1e9;
const int N = 2e5+5;

int k,n,q;
vector<int>adj[N],dep(N,0),val(N,0);

void dfs(int u,int p)
{
    for(auto it : adj[u]){
        if(it == p)
            continue;
        dep[it] = dep[u] + 1;
        dfs(it,u);
    }
}


void dfs1(int u,int p)
{
    for(auto it : adj[u]){
        if(it == p)
            continue;
        val[it] += val[u];
        dfs1(it,u);
    }
}



void solve(int tc = 0)
{
    cin >> n; 
    vector<ipair>edge;
    for(int i = 1,x,y; i < n; ++i){
        cin >> x >> y;
        adj[x].pb(y);
        adj[y].pb(x);
        edge.pb(mp(x,y));
    } 
    dfs(1,0);
    int s = 0;
    cin >> q;
    while(q--)
    {
        int t,e,v;
        cin >> t >>e >>v;
        s += v;
        int x = edge[e-1].ff;
        int y = edge[e-1].se;
        if(t == 2)
            swap(x,y);
        if(dep[x] > dep[y]){
            val[1] -= v;
            val[x] += v;
        }
        else{
            val[y] -= v;
        }
    }
    dfs1(1,-1);
    for(int i = 1; i<=n; ++i)
        cout<<(val[i]+s)<<"\n";

}

 

 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    if(test)
    cin>>t;
    for(int i = 1; i <= t; ++i){
        solve(i);
    }
    return 0;
} 
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<(n); i++)
#define sz(x) int(x.size())

using namespace std;
using ll = long long;
using P = pair<int,int>;
using tp = tuple<int,int> ;

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

void dfs(int v, ll x, int from, const vector<vector<int>>& e, vector<ll>& dp){
    dp[v] += x;
    for(int next : e[v]){
        if(next == from) continue;
        dfs(next,dp[v], v, e,dp);
    }
    return ;
}

void deepDFS(int x, int d, vector<int>& deep, const vector<vector<int>>& e){

    deep[x] = d;
    for(int u : e[x]){
        if(deep[u] >= 0) continue;;
        deepDFS(u,d+1,deep,e);
    }
}

int main(){
    int n; cin >> n;
    vector<vector<int>> e(n);
    vector<int> A(n);
    vector<int> B(n);
    rep(i,n-1){
        int a,b; cin >> a >> b;
        a--; b--;
        e[a].push_back(b);
        e[b].push_back(a);
        A[i] = a; B[i] = b;
    }
    vector<int> deep(n,-1);
    deepDFS(0,0,deep,e);

    int q; cin >> q;
    vector<ll> dp(n);
    rep(i,q){
        int t,ei,x; cin >> t >> ei >> x;
        ei--;
        int a,b; 
        if(t == 1) { a = A[ei]; b = B[ei]; }
        else { a = B[ei]; b = A[ei]; }

        if(deep[a] < deep[b]){
            dp[0] += x;
            dp[b] -= x;
        } else {
            dp[a] += x;
        }

    }

    dfs(0,0,-1,e,dp);
    rep(i,n) cout << dp[i] << endl;
    return 0;
}
