#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;

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;
}