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

#define rep(i, n) for (int i=0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;

int n;
vector<vector<int>> es;
vector<int> a, b;
vector<int> depth;

void DepthDFS(int a, int d){
    depth[a] = d;
    for (int next : es[a]){
        if (depth[next] == -1){
            DepthDFS(next, d+1);
        }
    }
}

vector<ll> dp;
void ImosDFS(int a, ll now){
    now += dp[a];
    dp[a] = now;
    for (int next : es[a]) {
        if (depth[next] > depth[a]) {
            ImosDFS(next, now);
        }
    }
}


int main(){
    cin >> n;
    es.resize(n);
    a.resize(n - 1);
    b.resize(n - 1);
    depth = vector<int>(n, -1);
    dp.resize(n);

    rep(i, n-1){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        es[a[i]].push_back(b[i]);
        es[b[i]].push_back(a[i]);
    }
    DepthDFS(0, 0);

    int q; cin >> q;
    rep(i, q){
        int t, e, x; cin >> t >> e >> x;
        e--;
        int va, vb;
        if (t == 1){
            va = a[e];
            vb = b[e];
        }
        else {
            vb = a[e];
            va = b[e];
        }
        if (depth[va] < depth[vb]) {
            dp[0] += x;
            dp[vb] -= x;
        }
        else {
            dp[va] += x;
        }
    }
    
    ImosDFS(0, 0);
    rep(i, n){
        cout << dp[i] << endl;
    }
    return 0;
}


#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define TIN(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
#define VIND(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem,--_elem
#define OUT(x) cout << x;
#define OUTL(x) cout << x << endl;
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

// 区間更新できる1-indexedなBIT
struct BIT {
    ll n; // 要素数
    vector<ll> bit[2]; // データ
    BIT(ll n) : n(n) {
        bit[0].assign(n+1, 0);
        bit[1].assign(n+1, 0);
    }
    // i番目にvを足す
    void add_sub(int p, int i, ll v) {
        if (!i) return;
        for(int x = i; x <= n; x += x & -x)
            bit[p][x] += v;
    }
    // 区間[l,r)にvを足す
    void add(int l, int r, ll v) {
        add_sub(0, l, -v * (l - 1));
        add_sub(0, r, v * (r - 1));
        add_sub(1, l, v);
        add_sub(1, r, -v);
    }
    ll sum_sub(int p, int i) {
        ll s = 0;
        for (int x = i; x > 0; x -= x & -x)
            s += bit[p][x];
        return s;
    }
    // [1,i]の総和
    ll sum(int i) {
        return sum_sub(0, i) + sum_sub(1, i) * i;
    }
    // [l,r]の総和
    ll sum(int l, int r) {
        return sum(r) - sum(l-1);
    }
};

void euler(V<V<ll>>& g, ll from, ll v, V<ll>& res, V<ll>& b, V<ll>& e)
{
    e[v] = b[v] = res.size();
    res.push_back(v);
    for (auto to : g[v]) {
        if (to == from) continue;
        euler(g, v, to, res, b, e);
        e[v] = res.size();
        res.push_back(v);
    }
}

void solve()
{
    IN(n);
    V<V<ll>> g(n);
    V<ll> a(n-1), b(n-1);
    rep(i, n-1) {
        cin >> a[i] >> b[i];
        --a[i]; --b[i];
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }
    V<ll> res;
    V<ll> bg(n), en(n);
    euler(g, -1, 0, res, bg, en);

    BIT bit(res.size());
    IN(q);
    rep(i, q) {
        IN(t, e, x);
        --e;
        ll from = t == 1 ? a[e] : b[e];
        ll noth = t == 1 ? b[e] : a[e];
        if (bg[from] < bg[noth]) {
            // nothはfromの子
            bit.add(1, res.size() + 1, x);
            bit.add(bg[noth] + 1, en[noth] + 2, -x);
        } else {
            bit.add(bg[from] + 1, en[from] + 2, x);
        }
    }
    rep(i, n)
        OUTL(bit.sum(bg[i] + 1, bg[i] + 1));
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}