#include <bits/stdc++.h>
using namespace std;
int n, a, b, cnt, head[300005], deep[300005], m, v, d, x;
long long ans[300005];
vector<pair<int, int> > ev[300005];
struct node {
  int to, next;
} e[300005 << 1];
void insert(int u, int v) {
  e[++cnt].to = v;
  e[cnt].next = head[u];
  head[u] = cnt;
  e[++cnt].to = u;
  e[cnt].next = head[v];
  head[v] = cnt;
}
void dfs(int x, int fa) {
  deep[x] = deep[fa] + 1;
  for (int i = head[x]; i; i = e[i].next)
    if (e[i].to ^ fa) {
      dfs(e[i].to, x);
    }
}
struct bits {
  long long s[300005 << 1];
  void add(int x, int v) {
    while (x) s[x] += v, x -= x & -x;
  }
  long long ask(int x) {
    long long res = 0;
    while (x <= n + n) res += s[x], x += x & -x;
    return res;
  }
} T;
void solve(int x, int fa) {
  for (int i = 0; i < ev[x].size(); i++) {
    T.add(deep[x] + ev[x][i].first, ev[x][i].second);
  }
  ans[x] = T.ask(deep[x]);
  for (int i = head[x]; i; i = e[i].next)
    if (e[i].to ^ fa) {
      solve(e[i].to, x);
    }
  for (int i = 0; i < ev[x].size(); i++) {
    T.add(deep[x] + ev[x][i].first, -ev[x][i].second);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &a, &b);
    insert(a, b);
  }
  dfs(1, 0);
  scanf("%d", &m);
  while (m--) {
    scanf("%d%d%d", &v, &d, &x);
    ev[v].push_back(make_pair(min(d, n), x));
  }
  solve(1, 0);
  for (int i = 1; i <= n; i++) printf("%I64d ", ans[i]);
  return 0;
}
