// 問題の URL を書いておく
// 

#include <bits/stdc++.h>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

#define rep(i, n) for(int i = 0; i < (int)(n); ++i)

using ll = long long;

struct Vertex
{
    vector<int> children;
    ll score{0};
    ll diff{0};
    int depth{-1};
};

void fillDepth(vector<Vertex>& vs, int t, int depth)
{
    vs[t].depth = depth;
    for(auto v : vs[t].children)
    {
        if(vs[v].depth == -1)
        {
            fillDepth(vs, v, depth + 1);
        }
    }
}

int main(int, const char**)
{
    int N;
    cin >> N;
    vector<pair<int, int>> edges(N - 1);
    vector<Vertex> v(N);
    rep(i, N - 1)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        edges[i] = {a, b};
        v[a].children.push_back(b);
        v[b].children.push_back(a);
    }
    fillDepth(v, 0, 0);

    int Q;
    cin >> Q;
    rep(i, Q)
    {
        int t, e, x;
        cin >> t >> e >> x;
        e--;
        int s, b;
        if(t == 1)
        {
            s = edges[e].first;
            b = edges[e].second;
        }
        else
        {
            s = edges[e].second;
            b = edges[e].first;
        }

        if(v[s].depth > v[b].depth)
        {
            v[s].diff += x;
        }
        else
        {
            v[b].diff -= x;
            v[0].diff += x;
        }
    }
#if 0
    rep(i, N)
    {
        printf("v[%d]:\n", i);
        for(auto c : v[i].children)
        {
            printf("  %d\n", c);
        }
    }
#endif
    queue<int> q;
    q.push(0);
    while(!q.empty())
    {
        auto t = q.front();
        q.pop();
        auto& tv = v[t];
        for(auto n : tv.children)
        {
            if(v[n].depth <= tv.depth) continue;
            v[n].diff += tv.diff;
            q.push({n});
        }
    }
    rep(i, N)
    {
        cout << v[i].diff << endl;
    }
    return 0;
}

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;

template <typename T1, typename T2>
void mmin(T1& a, const T2& b) {
  if (b < a) a = b;
}

template <typename T1, typename T2>
void mmax(T1& a, const T2& b) {
  if (b > a) a = b;
}

const int MAXN = 2e5 + 20;
int n, a[MAXN], b[MAXN], dfn[MAXN], ext[MAXN], clk = 0;
list<int> g[MAXN];
ll dif[MAXN], val[MAXN];

void dfs(int u, int fa) {
  dfn[u] = ++clk;
  for (int v : g[u])
    if (v != fa) dfs(v, u);
  ext[u] = clk;
}

void proc1(int e, ll x) {
  int u = a[e], v = b[e];
  // from u, without v
  if (dfn[u] <= dfn[v] && dfn[v] <= ext[u]) {
    // u -> v
    dif[1] += x;
    dif[n + 1] -= x;
    dif[dfn[v]] -= x;
    dif[ext[v] + 1] += x;
  } else {
    // v -> u
    dif[dfn[u]] += x;
    dif[ext[u] + 1] -= x;
  }
}

void proc2(int e, ll x) {
  int u = a[e], v = b[e];
  // from v, without u
  if (dfn[u] <= dfn[v] && dfn[v] <= ext[u]) {
    // u -> v
    dif[dfn[v]] += x;
    dif[ext[v] + 1] -= x;
  } else {
    // v -> u
    dif[1] += x;
    dif[n + 1] -= x;
    dif[dfn[u]] -= x;
    dif[ext[u] + 1] += x;
  }
}

void finalize() {
  for (int i = 1; i <= n; i++) val[i] = val[i - 1] + dif[i];
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a[i] >> b[i];
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  dfs(1, 0);
  int q;
  cin >> q;
  while (q--) {
    int t, e;
    ll x;
    cin >> t >> e >> x;
    if (t == 1) proc1(e, x);
    if (t == 2) proc2(e, x);
  }
  finalize();
  for (int i = 1; i <= n; i++) cout << val[dfn[i]] << "\n";
}
