#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 3e5 + 5;
vector<int> edg[maxn];
vector<pair<int, int> > op[maxn];
long long ans[maxn], add[maxn];
void dfs(int v, int fa, int h, long long sum) {
  for (int i = 0; i < op[v].size(); i++) {
    int l = h, r = h + op[v][i].first;
    add[l] += op[v][i].second;
    if (r + 1 < maxn) add[r + 1] -= op[v][i].second;
  }
  sum += add[h];
  ans[v] = sum;
  for (int i = 0; i < edg[v].size(); i++) {
    if (edg[v][i] == fa)
      continue;
    else {
      dfs(edg[v][i], v, h + 1, sum);
    }
  }
  for (int i = 0; i < op[v].size(); i++) {
    int l = h, r = h + op[v][i].first;
    add[l] -= op[v][i].second;
    if (r + 1 < maxn) add[r + 1] += op[v][i].second;
  }
}
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i <= n; i++) {
      edg[i].clear();
      op[i].clear();
      add[i] = 0;
      ans[i] = 0;
    }
    for (int i = 1; i < n; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      edg[x].push_back(y);
      edg[y].push_back(x);
    }
    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
      int v, d, x;
      scanf("%d%d%d", &v, &d, &x);
      op[v].push_back(make_pair(d, x));
    }
    dfs(1, 0, 0, 0);
    for (int i = 1; i <= n; i++) {
      printf("%I64d", ans[i]);
      if (i != n)
        printf(" ");
      else
        printf("\n");
    }
  }
  return 0;
}
