#include <bits/stdc++.h>
using namespace std;
inline void rd(int &x) {
  x = 0;
  register int f(1);
  register char c(getchar());
  while (c < '0' || '9' < c) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  x *= f;
}
const int maxn = 300010;
int n, m, dep[maxn];
long long tg[maxn], ans[maxn];
struct edge {
  int to, nxt;
} e[maxn << 1];
int head[maxn], k;
inline void add(const int &u, const int &v) {
  e[k] = (edge){v, head[u]}, head[u] = k++;
}
vector<pair<int, int> > q[maxn];
void dfs(int u, int pre, long long nw) {
  dep[u] = dep[pre] + 1, nw -= tg[dep[u]];
  for (auto &x : q[u])
    nw += x.second, tg[min(n, dep[u] + x.first) + 1] += x.second;
  ans[u] = nw;
  for (int i = head[u]; ~i; i = e[i].nxt)
    if (e[i].to ^ pre) dfs(e[i].to, u, nw);
  for (auto &x : q[u]) tg[min(n, dep[u] + x.first) + 1] -= x.second;
}
int main() {
  memset(head, -1, sizeof head), rd(n);
  for (int i = (2), ed = (n); i <= ed; ++i) {
    register int u, v;
    rd(u), rd(v), add(u, v), add(v, u);
  }
  rd(m);
  while (m--) {
    register int u, d, x;
    rd(u), rd(d), rd(x), q[u].push_back(make_pair(d, x));
  }
  dfs(1, 0, 0);
  for (int i = (1), ed = (n); i <= ed; ++i) printf("%lld ", ans[i]);
  puts("");
  return 0;
}
