#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000005;
long long n, m;
long long c[maxn], res[maxn], dep[maxn];
vector<long long> G[maxn];
vector<pair<long long, long long> > ans[maxn];
inline long long read() {
  long long s = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    s = s * 10 + c - 48;
    c = getchar();
  }
  return s * f;
}
long long lowbit(long long x) { return x & (-x); }
void add(long long x, long long d) {
  while (x < maxn) {
    c[x] += d;
    x += lowbit(x);
  }
}
long long query(long long x) {
  long long res = 0;
  while (x) {
    res += c[x];
    x -= lowbit(x);
  }
  return res;
}
void dfs(long long u, long long f) {
  for (long long i = 0; i < G[u].size(); i++) {
    long long v = G[u][i];
    if (v == f) {
      continue;
    }
    dep[v] = dep[u] + 1;
    dfs(v, u);
  }
}
void work(long long u, long long f) {
  for (long long i = 0; i < ans[u].size(); i++) {
    long long d = ans[u][i].first;
    long long w = ans[u][i].second;
    if (d > n) {
      d = n;
    }
    add(dep[u], w);
    add(dep[u] + d + 1, -w);
  }
  res[u] = query(dep[u]);
  for (long long i = 0; i < G[u].size(); i++) {
    long long v = G[u][i];
    if (v == f) {
      continue;
    }
    work(v, u);
  }
  for (long long i = 0; i < ans[u].size(); i++) {
    long long d = ans[u][i].first;
    long long w = ans[u][i].second;
    if (d > n) {
      d = n;
    }
    add(dep[u], -w);
    add(dep[u] + d + 1, w);
  }
}
signed main() {
  n = read();
  for (long long i = 0; i < n - 1; i++) {
    long long u = read(), v = read();
    G[u].push_back(v);
    G[v].push_back(u);
  }
  m = read();
  for (long long i = 0; i < m; i++) {
    long long v = read(), d = read(), x = read();
    ans[v].push_back(pair<long long, long long>{d, x});
  }
  dep[1] = 1;
  dfs(1, -1);
  work(1, -1);
  for (long long i = 1; i <= n; i++) {
    cout << res[i] << " ";
  }
  cout << endl;
  return 0;
}
