#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n, q;
vector<pair<int, int> > query[maxn];
vector<int> G[maxn];
long long ans[maxn];
long long add[maxn];
void dfs(int v, int p, int d, long long sum) {
  for (auto p : query[v]) {
    int l = d;
    int r = d + p.first + 1;
    add[l] += p.second;
    if (r < maxn) add[r] -= p.second;
  }
  sum += add[d];
  ans[v] = sum;
  for (int u : G[v]) {
    if (u == p) continue;
    dfs(u, v, d + 1, sum);
  }
  for (auto p : query[v]) {
    int l = d;
    int r = d + p.first + 1;
    add[l] -= p.second;
    if (r < maxn) add[r] += p.second;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].emplace_back(y);
    G[y].emplace_back(x);
  }
  scanf("%d", &q);
  while (q--) {
    int v, d, x;
    scanf("%d%d%d", &v, &d, &x);
    query[v].push_back(make_pair(d, x));
  }
  dfs(1, 0, 1, 0);
  for (int i = 1; i <= n; i++) {
    printf("%I64d ", ans[i]);
  }
  return 0;
}
