#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 10;
long long beg[maxn], nex[maxn], to[maxn], e;
inline void add(long long x, long long y) {
  e++;
  nex[e] = beg[x];
  beg[x] = e;
  to[e] = y;
}
long long n, m, dep[maxn], sz[maxn], ans[maxn];
long long id[maxn], num[maxn], cnt, rev[maxn];
inline void dfs(long long x, long long fa) {
  dep[x] = dep[fa] + 1;
  id[x] = ++cnt;
  num[cnt] = dep[x];
  rev[cnt] = x;
  sz[x] = 1;
  for (long long i = beg[x]; i; i = nex[i])
    if (to[i] != fa) dfs(to[i], x), sz[x] += sz[to[i]];
}
struct node {
  long long val, lazy, mn, mx;
} tr[maxn << 1];
inline void build(long long h, long long l, long long r) {
  if (l == r) {
    tr[h].mn = tr[h].mx = num[l];
    return;
  }
  long long mid = (l + r) >> 1;
  build(h << 1, l, mid);
  build(h << 1 | 1, mid + 1, r);
  tr[h].mn = min(tr[h << 1].mn, tr[h << 1 | 1].mn);
  tr[h].mx = max(tr[h << 1].mx, tr[h << 1 | 1].mx);
}
inline void pushup(long long h, long long l, long long r, long long vle) {
  tr[h].val += (r - l + 1) * vle;
  tr[h].lazy += vle;
}
inline void pushdown(long long h, long long l, long long r) {
  if (!tr[h].lazy) return;
  long long mid = (l + r) >> 1;
  pushup(h << 1, l, mid, tr[h].lazy);
  pushup(h << 1 | 1, mid + 1, r, tr[h].lazy);
  tr[h].lazy = 0;
}
inline void modify(long long h, long long l, long long r, long long x,
                   long long y, long long mxi, long long vle) {
  if (l > y || r < x) return;
  if (tr[h].mn > mxi) return;
  if (l >= x && r <= y && tr[h].mx <= mxi) {
    pushup(h, l, r, vle);
    return;
  }
  pushdown(h, l, r);
  long long mid = (l + r) >> 1;
  modify(h << 1, l, mid, x, y, mxi, vle);
  modify(h << 1 | 1, mid + 1, r, x, y, mxi, vle);
  tr[h].val = tr[h << 1].val + tr[h << 1 | 1].val;
}
inline void output(long long h, long long l, long long r) {
  if (l == r) {
    ans[rev[l]] = tr[h].lazy;
    return;
  }
  pushdown(h, l, r);
  long long mid = (l + r) >> 1;
  output(h << 1, l, mid);
  output(h << 1 | 1, mid + 1, r);
}
signed main() {
  cin >> n;
  long long x, y, z;
  for (long long i = 1; i < n; i++) {
    scanf("%lld%lld", &x, &y);
    add(x, y), add(y, x);
  }
  dfs(1, 0);
  build(1, 1, n);
  cin >> m;
  for (long long i = 1; i <= m; i++) {
    scanf("%lld%lld%lld", &x, &y, &z);
    modify(1, 1, n, id[x], id[x] + sz[x] - 1, dep[x] + y, z);
  }
  output(1, 1, n);
  for (long long i = 1; i <= n; i++) printf("%lld ", ans[i]);
  puts("");
  return 0;
}
