#include <bits/stdc++.h>
#include <string>

#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    for(int i=0;i<a;i++){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    for(int i=0;i<a;i++){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	    for(int i=0;i<t;i++){ fact[i+1]=fact[i]*(i+1)%MOD;}
	fact_inv[t]=power(fact[t], MOD-2);
	for(int i=0;i<t;i++){ fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;}
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

ll i,j,k,tmp;
//ll ans = 0;

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

	//グラフ定義
	vector<pair<ll,ll>> edge(N-1);	// 辺
	vector<vector<ll>> graph(N);	// グラフ(頂点ごとに隣接する点のvectorを保持)
	rep(i,N-1){
		ll a, b; cin >> a >> b; a--; b--;	// 0-index
		edge[i] = {a,b};
		graph[a].push_back(b);
		graph[b].push_back(a);
	}

	vector<ll> depth(N,-1);		// 頂点の深さ(-1で初期化)
	depth[0] = 0;
	vector<ll> v1; v1.push_back(0);

	// 各頂点の深さを計算(幅優先探索)
	while(v1.size() > 0){
		ll now = v1.back(); v1.pop_back();
		for(ll i : graph[now]){
			if(depth[i] == -1){
				depth[i] = depth[now] + 1; v1.push_back(i);
			}
		}
	}

	// クエリ処理
	vector<ll> ans(N,0);
	ll Q; cin >> Q;
	rep(i,Q){
		ll t,e,x; cin >> t >> e >> x;
		pair<ll,ll> p = edge[e-1];
		if(t == 1){
			if(depth[p.first] > depth[p.second]){
				ans[p.first] += x;
			}
			else{
				ans[p.second] -= x; ans[0] += x;
			}
		}
		else{
			if(depth[p.first] > depth[p.second]){
				ans[p.first] -= x; ans[0] += x;
			}
			else{
				ans[p.second] += x;
			}
		}
	}

	vector<ll> v2; v2.push_back(0);
	// 各頂点の答えを計算(幅優先探索)
	while(v2.size() > 0){
		ll now = v2.back(); v2.pop_back();
		for(ll i : graph[now]){
			if(depth[i] > depth[now]){
				ans[i] += ans[now]; v2.push_back(i);
			}
		}
	}

	rep(i,N){cout << ans[i] << endl;}

  return 0;
}

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

typedef long long int ll;
ll n, a, b, q, c[200007], buf, p[200007];
vector<pair<ll, ll>> e;
vector<pair<ll, bool>> op[200007];
vector<ll> adj[200007];

void find_parent(ll x, ll par) {
    p[x] = par;
    for(ll i : adj[x]) {
        if(i != par) {
            find_parent(i, x);
        }
    }
}

void dfs(ll x, ll add) {
    ll cur = add;
    for(pair<ll, bool> i : op[x]) {
        if(i.second) {
            cur += i.first;
        } else {
            cur -= i.first;
            buf += i.first;
        }
    }

    c[x] += cur;
    for(ll i : adj[x]) {
        if(i != p[x]) {
            dfs(i, cur);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for(ll i = 0; i < n - 1; ++i) {
        cin >> a >> b;
        e.push_back({a, b});
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    find_parent(1, -1);

    cin >> q;
    for(ll i = 0; i < q; ++i) {
        ll t, k, x;
        cin >> t >> k >> x;
        k--;
        if(t == 1) { //1 - adding to subtree, 0 - subtracting and adding to buffer
            if(p[e[k].first] == e[k].second) op[e[k].first].push_back({x, 1});
            else op[e[k].second].push_back({x, 0});
        } else {
            if(p[e[k].second] == e[k].first) op[e[k].second].push_back({x, 1});
            else op[e[k].first].push_back({x, 0});
        }
    }

    dfs(1, 0);

    for(ll i = 1; i <= n; ++i) cout << c[i] + buf << '\n';
    return 0;
}