#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5+4;
ll seg[4*N], lazy[4*N];
vector<int> g[N];
int in[N], out[N], timer = 0;

void propagate(int node, int l, int r)
{
    if(lazy[node]==0)
        return;
    seg[node] += lazy[node] * (r-l+1);
    if(l != r)
    {
        lazy[node << 1] += lazy[node];
        lazy[node << 1 | 1] += lazy[node];
    }
    lazy[node] = 0;
}

void update(int node, int l, int r, int s, int e, ll val)
{
    propagate(node, l, r);
    if(e < l || r < s)
        return;
    if(s <= l && r <= e)
    {
        lazy[node] += val;
        propagate(node, l, r);
        return;
    }
    int mid = (l+r) >> 1;
    update(node << 1, l, mid, s, e, val);
    update(node << 1|1, mid+1, r, s, e, val);
    seg[node] = seg[node << 1] + seg[node << 1 | 1];
}

ll query(int node, int l, int r, int idx)
{
    propagate(node, l, r);
    if(idx < l || idx > r)
        return 0;
    if(l == r)
        return seg[node];
    int mid = (l+r) >>1;
    return query(node << 1, l, mid, idx) + query(node<<1|1, mid+1, r, idx);
}

void dfs(int node, int parent)
{
    in[node] = ++timer;

    for(auto v : g[node])
    {
        if(v == parent)
            continue;
        dfs(v, node);
    }
    
    out[node] = timer;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> edge;
    for (int i = 0; i < n-1; i++)
    {
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
        edge.emplace_back(x,y);
    }
    dfs(1, -1);

    int q;
    cin >> q;
    while(q--)
    {
        int op, e, x;
        cin >> op >> e >> x, e--;
        int a = edge[e].first, b = edge[e].second;
        if(op == 2)
            swap(a, b);
        if(in[a] < in[b])
        {
            update(1, 1, n, 1, n, x);
            update(1, 1, n, in[b], out[b], -x);
        }
        else
            update(1, 1, n, in[a], out[a], x);
    }
    for(int i = 1; i <= n; i++)
        cout << query(1, 1, n, in[i]) << endl;
    return 0;
}
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"

using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vpi vector<pi>
#define fr(i, a, b) \
    for (auto i = (a); i != (b); i++)
typedef long long ll;
typedef pair<int, int> pi;

template <class T>
class fenwick {
    int size;
    vector<T> arr, _arr, act;

   public:
    fenwick(int N) {
        size = N;
        arr.resize(N + 1, 0);
        act.resize(N + 1, 0);
        _arr.resize(N + 1, 0);
    }

    void add(int k, T x) {
        while (k <= size) {
            act[k] += x;
            k += k & -k;
        }
    }

    void _add(int k, T x) {
        while (k <= size) {
            arr[k] += x;
            k += k & -k;
        }
    }

    void __add(int k, T x) {
        while (k <= size) {
            _arr[k] += x;
            k += k & -k;
        }
    }

    T sum(int k) {
        int temp = k;
        T s = 0, t = 0;
        while (k >= 1) {
            s += act[k];
            k -= k & -k;
        }
        k = temp;
        while (k >= 1) {
            t += arr[k];
            k -= k & -k;
        }
        t *= temp;
        k = temp;
        while (k >= 1) {
            t -= _arr[k];
            k -= k & -k;
        }
        return s + t;
    }

    void range_add(int l, int r, T val) {
        _add(l, val);
        _add(r + 1, -val);
        __add(l, val * (l - 1));
        __add(r + 1, -val * r);
    }
};

int dfs(int node, vector<bool> &vis, vi &s, vector<vi> &a, vi &tra, vi &p) {
    tra.eb(node);
    int size = 1;
    vis[node] = true;
    for (int u : a[node]) {
        if (!vis[u]) {
            size += dfs(u, vis, s, a, tra, p);
            p[u] = node;
        }
    }
    s[node] = size;
    return size;
}

const ll mod = 1e9 + 7;

int32_t main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vpi a(n - 1);
    vector<vi> adj(n);

    fr(i, 0, n - 1) {
        cin >> a[i].F >> a[i].S;
        adj[a[i].S - 1].pb(a[i].F - 1);
        adj[a[i].F - 1].pb(a[i].S - 1);
        a[i].F--;
        a[i].S--;
    }

    vi s(n), p(n, -1);
    vi tra;
    vector<bool> vis(n, false);
    dfs(0, vis, s, adj, tra, p);
    fenwick<ll> f(n);
    vi ac(n);

    for (int i = 0; i < n; i++) {
        ac[tra[i]] = i + 1;
    }

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        ll t, e, x;
        cin >> t >> e >> x;
        e--;
        if (t == 1) {
            int node = a[e].F;
            if (p[node] == a[e].S) {
                f.range_add(ac[node], ac[node] + s[node] - 1, x);
            } else {
                f.range_add(1, n, x);
                f.range_add(ac[a[e].S], ac[a[e].S] + s[a[e].S] - 1, -x);
            }
        } else {
            int node = a[e].S;
            if (p[node] == a[e].F) {
                f.range_add(ac[node], ac[node] + s[node] - 1, x);
            } else {
                f.range_add(1, n, x);
                f.range_add(ac[a[e].F], ac[a[e].F] + s[a[e].F] - 1, -x);
            }
        }
    }

    for (int i = 0; i < n; i++) {
        ll answer = f.sum(ac[i]) - f.sum(ac[i] - 1);
        cout << answer << "\n";
    }

    return 0;
}