#include <bits/stdc++.h>
using namespace std;
const int NMAX = 300010;
int n, m;
vector<int> g[NMAX];
vector<pair<int, int>> node[NMAX];
long long delta[NMAX];
long long num[NMAX];
int dfs(int u, int fa, long long sum, int deep) {
  for (int i = 0; i < node[u].size(); i++) {
    sum += node[u][i].second;
    if ((deep + node[u][i].first + 1) < NMAX)
      delta[deep + node[u][i].first + 1] += node[u][i].second;
  }
  sum -= delta[deep];
  num[u] = sum;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == fa) continue;
    dfs(v, u, sum, deep + 1);
  }
  sum += delta[deep];
  for (int i = 0; i < node[u].size(); i++) {
    sum -= node[u][i].second;
    if ((deep + node[u][i].first + 1) < NMAX)
      delta[deep + node[u][i].first + 1] -= node[u][i].second;
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int v, d, x;
    scanf("%d%d%d", &v, &d, &x);
    node[v].push_back(make_pair(d, x));
  }
  dfs(1, -1, 0LL, 0);
  for (int i = 1; i <= n; i++) printf("%I64d ", num[i]);
  printf("\n");
  return 0;
}
