#include <bits/stdc++.h>
using namespace std;
vector<int> mp[300005];
vector<pair<int, int> > qu[300005];
long long tree[1200005], lazy[1200005];
long long ans[300005];
void down(int p, int l, int r) {
  int mid = (l + r) >> 1;
  if (lazy[p]) {
    lazy[p << 1] += lazy[p];
    lazy[p << 1 | 1] += lazy[p];
    tree[p << 1] += lazy[p] * (mid - l + 1);
    tree[p << 1 | 1] += lazy[p] * (r - mid);
    lazy[p] = 0;
  }
}
void update(int p, int l, int r, int ql, int qr, int d) {
  if (ql == l && qr == r) {
    lazy[p] += d;
    tree[p] += 1LL * d * (r - l + 1);
    return;
  }
  down(p, l, r);
  int mid = (l + r) >> 1;
  if (qr <= mid)
    update(p << 1, l, mid, ql, qr, d);
  else if (ql > mid)
    update(p << 1 | 1, mid + 1, r, ql, qr, d);
  else {
    update(p << 1, l, mid, ql, mid, d);
    update(p << 1 | 1, mid + 1, r, mid + 1, qr, d);
  }
}
long long query(int p, int l, int r, int x) {
  int mid = (l + r) >> 1;
  if (l == r) return tree[p];
  down(p, l, r);
  if (x <= mid)
    return query(p << 1, l, mid, x);
  else
    return query(p << 1 | 1, mid + 1, r, x);
}
void dfs(int x, int fa, int step) {
  for (int i = 0; i < qu[x].size(); i++)
    update(1, 1, 300000, step, min(step + qu[x][i].first, 300000),
           qu[x][i].second);
  ans[x] = query(1, 1, 300000, step);
  for (int i = 0; i < mp[x].size(); i++)
    if (mp[x][i] != fa) dfs(mp[x][i], x, step + 1);
  for (int i = 0; i < qu[x].size(); i++)
    update(1, 1, 300000, step, min(step + qu[x][i].first, 300000),
           -qu[x][i].second);
}
int main() {
  int n, x, y, m, v, d, tt;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d", &x, &y);
    mp[x].push_back(y);
    mp[y].push_back(x);
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &v, &d, &x);
    qu[v].push_back(make_pair(d, x));
  }
  dfs(1, 0, 1);
  for (int i = 1; i <= n; i++)
    if (i != n)
      printf("%I64d ", ans[i]);
    else
      printf("%I64d\n", ans[i]);
  return 0;
}
