#include <bits/stdc++.h>
using namespace std;
const int N = int(3e5) + 5;
const int inf = (int)1e9 + 7;
struct bit {
  long long t[3 * N];
  void inc(int x, int y) {
    for (; x < N; x += x & -x) t[x] += y;
  }
  long long get(int x) {
    long long ans = 0;
    for (; x > 0; x -= x & -x) ans += t[x];
    return ans;
  }
} tr;
int n, q;
vector<int> g[N];
long long ans[N];
vector<pair<int, int> > qr[N];
void dfs(int v, int p, int lv) {
  for (pair<int, int> i : qr[v]) {
    tr.inc(lv, i.second);
    tr.inc(lv + i.first + 1, -i.second);
  }
  ans[v] = tr.get(lv);
  for (int i : g[v]) {
    if (i == p) continue;
    dfs(i, v, lv + 1);
  }
  for (pair<int, int> i : qr[v]) {
    tr.inc(lv, -i.second);
    tr.inc(lv + i.first + 1, i.second);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    int v, d, x;
    scanf("%d %d %d", &v, &d, &x);
    d = min(d, n);
    qr[v].push_back(make_pair(d, x));
  }
  dfs(1, 1, 1);
  for (int i = 1; i <= n; ++i) {
    printf("%lld ", ans[i]);
  }
  return 0;
}
