#include <bits/stdc++.h>
static const int MOD = 1000000007;
static long long gcd(long long x, long long y) {
  return (!y) ? x : gcd(y, x % y);
}
static const int maxn = 1 << 19;
int N, Q, head[maxn], dst[maxn * 2], nxt[maxn * 2];
long long tree[maxn * 2];
int deep[maxn];
long long weight[maxn];
std::vector<std::pair<int, int> > g[maxn];
void add_edge(int x, int y) {
  static int p = 1;
  ++p;
  nxt[p] = head[x];
  dst[p] = y;
  head[x] = p;
  ++p;
  nxt[p] = head[y];
  dst[p] = x;
  head[y] = p;
}
void add_tree(int x, long long val) {
  for (x += maxn; x > 1; x >>= 1) {
    tree[x] += val;
  }
}
long long get_tree(int x) {
  long long res = 0;
  for (x += 1 + maxn; x > 1; x >>= 1) {
    if (x & 1) res += tree[--x];
  }
  return res;
}
void dfs(int x, int pa) {
  for (std::pair<int, int> p : g[x]) {
    int d = p.first;
    long long val = p.second;
    d = std::max<int>(1, deep[x] - d);
    add_tree(d, val);
  }
  weight[x] = get_tree(deep[x]);
  for (int h = head[x]; h; h = nxt[h]) {
    int y = dst[h];
    if (y == pa) continue;
    deep[y] = deep[x] - 1;
    dfs(y, x);
  }
  for (std::pair<int, int> p : g[x]) {
    int d = p.first;
    long long val = p.second;
    d = std::max<int>(1, deep[x] - d);
    add_tree(d, -val);
  }
}
int solve() {
  scanf("%d", &N);
  for (int i = 1; i < N; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    add_edge(x, y);
  }
  scanf("%d", &Q);
  while (Q--) {
    int x, v, d;
    scanf("%d%d%d", &v, &d, &x);
    g[v].push_back(std::pair<int, int>(d, x));
  }
  deep[1] = N;
  dfs(1, 0);
  for (int i = 1; i <= N; ++i) {
    printf("%lld ", weight[i]);
  }
  return 0;
}
int main(int argc, char* argv[]) {
  ::std::ios::sync_with_stdio(false);
  ::std::cin.tie(0);
  ::std::cout.tie(0);
  int test_count = 1;
  while (test_count--) solve();
  return 0;
}
