#include <bits/stdc++.h>
using namespace std;
long long n, q, a[300010], f[300010], ans[300010], g[300010];
struct edge {
  long long v, next;
} e[300010 << 1];
long long eid, p[300010];
void insert(long long u, long long v) {
  e[++eid] = {v, p[u]};
  p[u] = eid;
}
long long dep[300010], cnt, c[300010], d[300010], siz[300010];
pair<long long, long long> b[300010];
void dfs(long long u, long long f) {
  siz[u] = 1;
  c[u] = ++cnt, d[cnt] = u;
  dep[u] = dep[f] + 1;
  b[u] = make_pair(dep[u], c[u]);
  for (int i = p[u]; i; i = e[i].next) {
    long long v = e[i].v;
    if (v == f) continue;
    dfs(v, u);
    siz[u] += siz[v];
  }
}
void dfs1(long long u, long long f) {
  g[u] += g[f];
  for (int i = p[u]; i; i = e[i].next) {
    long long v = e[i].v;
    if (v == f) continue;
    dfs1(v, u);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    long long u, v;
    cin >> u >> v;
    insert(u, v);
    insert(v, u);
  }
  dfs(1, 0);
  sort(b + 1, b + n + 1);
  cin >> q;
  while (q--) {
    long long v, d, x;
    cin >> v >> d >> x;
    a[c[v]] += x, a[c[v] + siz[v]] -= x;
    long long l =
        lower_bound(b + 1, b + n + 1, make_pair(dep[v] + d + 1, c[v])) - b;
    long long r = lower_bound(b + 1, b + n + 1,
                              make_pair(dep[v] + d + 1, c[v] + siz[v])) -
                  b;
    f[l] -= x, f[r] += x;
  }
  for (int i = 1; i <= n; ++i) a[i] += a[i - 1], f[i] += f[i - 1];
  for (int i = 1; i <= n; ++i) g[d[b[i].second]] = f[i];
  dfs1(1, 0);
  for (int i = 1; i <= n; ++i) ans[d[i]] += a[i];
  for (int i = 1; i <= n; ++i) cout << ans[i] + g[i] << " ";
  cout << endl;
  return 0;
}
