#include <bits/stdc++.h>
using namespace std;
long long n, x, y, d, q;
long long L[300010], F[300010], A[300010];
vector<pair<long long, long long> > Q[300010];
vector<long long> E[300010];
void upd(long long x, long long y) {
  for (; x <= n; x += (x & (-x))) F[x] += y;
}
long long tap(long long x) {
  long long ret = 0;
  for (; x > 0; x -= (x & (-x))) ret += F[x];
  return ret;
}
void dfs(long long nd, long long pr) {
  L[nd] = L[pr] + 1;
  for (auto i : Q[nd]) {
    upd(L[nd], i.second);
    upd(L[nd] + i.first + 1, -i.second);
  }
  A[nd] = tap(L[nd]);
  for (auto i : E[nd])
    if (i != pr) dfs(i, nd);
  for (auto i : Q[nd]) {
    upd(L[nd], -i.second);
    upd(L[nd] + i.first + 1, i.second);
  }
}
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i < n; i++) {
    scanf("%lld%lld", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  scanf("%lld", &q);
  while (q--) {
    scanf("%lld%lld%lld", &x, &d, &y);
    Q[x].push_back({d, y});
  }
  dfs(1, 0);
  for (long long i = 1; i <= n; i++) printf("%lld ", A[i]);
}
