/*
python3 ../../CompetitionHelpers/run_codeforces.py --problem E --test 0
g++ -ggdb -fsanitize=address -std=c++14 E.cpp && ./a.out <<< "5
1 2
2 3
2 4
4 5
4
1 1 1
1 4 10
2 1 100
2 2 1000"

g++ -ggdb -fsanitize=address -std=c++14 E.cpp && ./a.out <<< "7
2 1
2 3
4 2
4 5
6 1
3 7
7
2 2 1
1 3 2
2 2 4
1 6 8
1 3 16
2 4 32
2 1 64"
*/

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

#define rep(i, a, b) for (int i = a; i < (b); i++)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename A>
string to_string(A v) { int cnt = 0; string res; for (const auto &x : v) { if (cnt++) res += " "; res += to_string(x); } return "[" + res + "]"; }
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

template<typename T>
void output_vector(const vector<T> &v, int start = 0, int end = -1) {
    if (end < 0) end = int(v.size());
    for (int i = start; i < end; i++)
        cout << v[i] << (i < end - 1 ? ' ' : '\n');
}

int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);

    int N; cin >> N;
    vector<vi> Edges(N - 1, vi(2)); rep(i, 0, N - 1) rep(j, 0, 2) cin >> Edges[i][j];

    vector<vi> Adj(N + 1);
    {
        trav(ab, Edges) {
            int a = ab[0]; int b = ab[1];
            Adj[a].push_back(b);
            Adj[b].push_back(a);
        }
    }

    int root = 1;
    vector<vi> Kids(N + 1);
    vi Parents(N + 1, -1);
    {
        auto dfsHangTree = [&](auto& self, int node, int par)->void {
            Parents[node] = par;
            trav(sib, Adj[node]) {
                if (sib != par) {
                    Kids[node].push_back(sib);
                    self(self, sib, node);
                }
            }
        };
        dfsHangTree(dfsHangTree, root, -1);
    }

    vector<ll> Values(N + 1, 0);

    int Q; cin >> Q;
    rep(qi, 0, Q) {
        int ti, ei; cin >> ti >> ei;
        ll xi; cin >> xi;
        int ai = Edges[ei - 1][0];
        int bi = Edges[ei - 1][1];

        if (Parents[ai] == bi) {
            if (ti == 1)
                Values[ai] += xi;

            else {
                Values[ai] -= xi;
                Values[root] += xi;
            }
        }
        else {
            if (ti == 2)
                Values[bi] += xi;
            else {
                Values[bi] -= xi;
                Values[root] += xi;
            }
        }
    }

    vector<ll> Ans(N, 0);

    auto dfsAns = [&](auto& self, int node, ll cursum)->void {
        Ans[node - 1] = cursum;
        trav(kid, Kids[node]) {
            self(self, kid, cursum + Values[kid]);
        }
    };
    dfsAns(dfsAns, root, Values[root]);

    trav(x, Ans)
        cout << x << "\n";
}
#include <stdio.h>
#include <vector>

#define N 200005

using namespace std;

long long sum[N];
long long ans[N];
int dis[N], dis_cnt;
int n;

struct EDGE
{
    int x, y;
}edge[N];

vector<int> e[N];

void dfs(int x, int pa)
{
    dis[x] = ++dis_cnt;

    for (int i = 0; i < e[x].size(); i++) {
        int y = e[x][i];
        if (y != pa) dfs(y, x);
    }
}

void dfs2(int x, int pa, long long total)
{
    ans[x] = total + sum[x];

    for (int i = 0; i < e[x].size(); i++) {
        int y = e[x][i];
        if (y != pa) dfs2(y, x, total+sum[x]);
    }
}

int main()
{
    scanf("%d", &n);

    for (int i = 1; i < n; i++) {
        scanf("%d %d", &edge[i].x, &edge[i].y);
        e[edge[i].x].push_back(edge[i].y);
        e[edge[i].y].push_back(edge[i].x);
    }

    dfs(1, 0);

    int q;
    scanf("%d", &q);
    for (int i = 1; i <= q; i++) {
        int t, a, b;
        scanf("%d %d %d", &t, &a, &b);
        if (t == 1) {
            if (dis[edge[a].x] > dis[edge[a].y]) sum[edge[a].x] += b;
            else {
                sum[1] += b;
                sum[edge[a].y] -= b;
            }
        }
        else {
            if (dis[edge[a].y] > dis[edge[a].x]) sum[edge[a].y] += b;
            else {
                sum[1] += b;
                sum[edge[a].x] -= b;
            }
        }
    }

    dfs2(1, 0, 0LL);

    for (int i = 1; i <= n; i++) printf("%lld\n", ans[i]);

    return 0;
}