#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define deb(x) cout << #x << " " << x << endl;
#define mod 1000000007
#define fast std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define rall(v) v.rbegin(), v.rend()
const ll INF = 1e18;
//const ll NEGINF = -1 * INF;
const ll N = 1e6 + 1;

ll gcd(ll a, ll b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}

ll my_pow(ll a, ll n, ll m = INF)
{
    ll res = 1;
    while (n)
    {
        if (n % 2)
        {
            res = (res * a) % m;
            n--;
        }
        a = (a * a) % m;
        n /= 2;
    }
    return res;
}

void solve()
{
    ll N;
    cin >> N;
    vector<pair<ll, ll>> edge(N - 1);
    vector<vector<ll>> g(N);
    for (ll i = 0; i < N - 1; i++)
    {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
        edge[i] = {a, b};
    }
    vector<ll> depth(N, -1);
    depth[0] = 0;
    vector<ll> q = {0};
    while (q.size())
    {
        ll at = q.back();
        q.pop_back();
        for (ll i : g[at])
            if (depth[i] == -1)
            {
                depth[i] = depth[at] + 1;
                q.push_back(i);
            }
    }
    vector<ll> s(N);
    ll Q;
    cin >> Q;
    while (Q--)
    {
        ll t, e, x;
        cin >> t >> e >> x;
        auto [a, b] = edge[e - 1];
        if (depth[a] > depth[b])
        {
            swap(a, b);
            t ^= 3;
        }
        if (t == 1)
        {
            s[0] += x;
            s[b] -= x;
        }
        else
            s[b] += x;
    }
    q = {0};
    while (q.size())
    {
        ll at = q.back();
        q.pop_back();
        for (ll i : g[at])
            if (depth[at] < depth[i])
            {
                s[i] += s[at];
                q.push_back(i);
            }
    }
    for (ll i : s)
        cout << i << endl;
}

int main()
{
    fast;
#ifndef ONLINE_JUDGE
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/input.txt", "r", stdin);
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/output.txt", "w", stdout);
#endif
    int T = 1;
    while (T--)
    {
        solve();
    }
    //cout<< "Done in " << clock() / CLOCKS_PER_SEC <<"sec"<< endl;
    return 0;
}
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 1000000007 // 10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef struct Node{
	int depth;
	vector<int> adj;
	ll val;
	bool imos;
}Node;

void det_depth(vector<Node> &tree, int id, int depth){
	if(tree[id].depth != -1)return;
	tree[id].depth = depth;
	for(auto v : tree[id].adj){
		det_depth(tree, v, depth+1);
	}
}

void imos(vector<Node> &tree, int id, ll sum){
	if(tree[id].imos)return;
	tree[id].imos = true;
	tree[id].val += sum;
	for(auto v : tree[id].adj){
		imos(tree, v, tree[id].val);
	}
}

signed main()
{
	int N;
	cin >> N;
	vector<pair<int, int>> edge(N);
	vector<Node> tree(N);
	REP(i, N-1){
		int a, b;
		cin >> a >> b;
		edge[i] = (MP(a-1, b-1));
		tree[i].val = 0;
		tree[i].depth = -1;
		tree[i].imos = false;
		tree[a-1].adj.PB(b-1);
		tree[b-1].adj.PB(a-1);
	}
	tree[N-1].val = 0;
	tree[N-1].depth = -1;
	tree[N-1].imos = false;
	det_depth(tree, 0, 0);
	int Q;
	cin >> Q;
	REP(i, Q){
		int t, e, x;
		cin >> t >> e >> x;
		int a = edge[e-1].F, b = edge[e-1].S;
		if(tree[b].depth<tree[a].depth){
			int tmp = a;
			a = b;
			b = tmp;
			if(t == 1){
				t = 2;
			}else{
				t = 1;
			}
		}
		if(t == 1){
			tree[0].val += x;
			tree[b].val -= x;
		}else{
			tree[b].val += x;
		}
	}
	imos(tree, 0, 0);
	for(auto v : tree){
		cout << v.val << endl;
	}
}
