#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define x() real()
#define y() imag()
#define vec(a, b) ((b) - (a))
#define dot(a, b) (conj(a) * (b)).real()
#define fastIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
const ld eps = 1e-6;
const int N = 2e5 + 7;
ll values[N];
ll all = 0;
vector<int> g[N];
pair<int, int> edges[N];
int parent[N];
int in[N];

void dfs(int node, ll value, int par) {
    values[node] += value;
    for (auto i : g[node]) {
        if (i != par)
            dfs(i, values[node], node);
    }
}

void dfs1(int node, int par) {
    parent[node] = par;
    for (auto i : g[node]) {
        if (i != par) {
            dfs1(i, node);
        }
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n-1; i++) {
        int a, b;
        cin >> a >> b;
        edges[i] = {a, b};
        g[a].push_back(b);
        g[b].push_back(a);
        in[b]++;
    }
    int root = 1;
    dfs1(root, -1);
    int q;
    cin >> q;
    while (q--) {
        ll t, e, x;
        cin >> t >> e >> x;
        int a = edges[e].first, b = edges[e].second;
        if (t == 1) {
            // a, b
            if (parent[b] == a) {
                all += x;
                values[b] -= x;
            }
            else {
               values[a] += x;
            }
        }
        else {
            if (parent[a] == b) {
                all += x;
                values[a] -= x;
            }
            else {
                values[b] += x;
            }
        }
    }
    dfs(root, all, -1);
    for (int i = 1; i <= n; i++) {
        cout << values[i] << '\n';
    }
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
template<typename T> bool chmax(T &a, T b) {if(a<b){a=b; return 1; } return 0; }
template<typename T> bool chmin(T &a, T b) {if(a>b){a=b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
ll mpow(ll x, ll p) {
	if (p==0) return 1;
	ll res=mpow(x,p/2); res=res*res%MOD;
	return p%2?res*x%MOD:res;
}
ll lpow(ll x, ll p) {
	if (p==0) return 1;
	ll res=lpow(x,p/2); res*=res;
	return p%2?res*x:res;
}

vector<int> to[200005];
int par[200005];
int seen[200005];

ll imos[200005];

void dfs(int prev, int cur) {
	par[cur] = prev;
	seen[cur] = 1;
	if (prev != -1) imos[cur] += imos[prev];
	for (int nx: to[cur]) {
		if (seen[nx]) continue;
		dfs(cur, nx);
	}
}


int main() {
	int n;
	cin >> n;
	vector<int> a(n-1), b(n-1);
	// 隣接リストにデータを追加
	rep(i,n-1) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		to[a[i]].push_back(b[i]);
		to[b[i]].push_back(a[i]);
	}
	// 0を根として、各頂点の親を記録する
	dfs(-1, 0);
	int q;
	cin >> q;
	rep(i,q) {
		int t, e, x;
		cin >> t >> e >> x;
		e--;
		int v = a[e], u = b[e];
		// tが2のときは、vとuをswapすれば操作が同じになる
		if (t == 2) swap(v, u);
		if (par[u] == v) {
			imos[0] += x;
			imos[u] -= x;
		}
		else {
			imos[v] += x;
		}
	}
	// seenの値を0にして、再度dfsを実行する
	rep(i,n) seen[i] = 0;
	dfs(-1, 0);
	rep(i,n) cout << imos[i] << endl;
}