#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const long long N = 3e5 + 10;
const long long inf = 1e9;
const double eps = 1;
int n, m;
long long ans[N], t[N * 4];
vector<vector<int>> v(N);
vector<vector<pair<int, int>>> q(N);
void update(int tv, int tl, int tr, int l, int r, long long val) {
  if (r < l) return;
  if (l == tl && r == tr)
    t[tv] += val;
  else {
    int tm = (tl + tr) >> 1;
    update(tv * 2, tl, tm, l, min(tm, r), val);
    update(tv * 2 + 1, tm + 1, tr, max(tm + 1, l), r, val);
  }
}
long long get(int tv, int tl, int tr, int pos) {
  if (tl == tr) return t[tv];
  int tm = (tl + tr) >> 1;
  if (pos <= tm)
    return t[tv] + get(tv * 2, tl, tm, pos);
  else
    return t[tv] + get(tv * 2 + 1, tm + 1, tr, pos);
}
void dfs(int x, int par, int d) {
  for (auto c : q[x]) {
    int l = d, r = min(n, c.first + d);
    update(1, 1, n, l, r, c.second);
  }
  ans[x] = get(1, 1, n, d);
  for (int y : v[x]) {
    if (y == par) continue;
    dfs(y, x, d + 1);
  }
  for (auto c : q[x]) {
    int l = d, r = min(n, c.first + d);
    update(1, 1, n, l, r, -c.second);
  }
}
void solve() {
  scanf("%d\n", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d\n", &x, &y);
    v[x].push_back(y), v[y].push_back(x);
  }
  scanf("%d\n", &m);
  while (m--) {
    int x, dis, val;
    scanf("%d %d %d\n", &x, &dis, &val);
    q[x].push_back({dis, val});
  }
  dfs(1, -1, 1);
  for (int i = 1; i <= n; i++) {
    printf("%lld ", ans[i]);
  }
}
int main() {
  int T;
  T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
