#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long INF = 1LL << 60;
const int MaxN = 300000;
int n, Q;
struct Segtree {
  int l, r;
  long long sum;
} tree[4 * MaxN + 5];
long long lazy[4 * MaxN + 5];
void push_up(int rt) {
  tree[rt].sum = tree[rt << 1].sum + tree[rt << 1 | 1].sum;
}
void push_down(int rt) {
  if (lazy[rt]) {
    tree[rt << 1].sum += (tree[rt << 1].r - tree[rt << 1].l + 1) * lazy[rt];
    tree[rt << 1 | 1].sum +=
        (tree[rt << 1 | 1].r - tree[rt << 1 | 1].l + 1) * lazy[rt];
    lazy[rt << 1] += lazy[rt];
    lazy[rt << 1 | 1] += lazy[rt];
    lazy[rt] = 0;
  }
}
void Build(int rt, int l, int r) {
  tree[rt].l = l, tree[rt].r = r;
  if (l == r) {
    tree[rt].sum = 0LL;
    return;
  }
  long long mid = (l + r) >> 1;
  Build(rt << 1, l, mid);
  Build(rt << 1 | 1, mid + 1, r);
  push_up(rt);
}
void update(int rt, int L, int R, long long val) {
  if (L <= tree[rt].l && tree[rt].r <= R) {
    tree[rt].sum += (long long)(tree[rt].r - tree[rt].l + 1) * val;
    lazy[rt] += (long long)val;
    return;
  }
  push_down(rt);
  long long mid = (tree[rt].l + tree[rt].r) >> 1;
  if (L <= mid) update(rt << 1, L, R, val);
  if (R > mid) update(rt << 1 | 1, L, R, val);
  push_up(rt);
}
long long query(int rt, int L, int R) {
  if (L <= tree[rt].l && tree[rt].r <= R) return tree[rt].sum;
  push_down(rt);
  long long mid = (tree[rt].l + tree[rt].r) >> 1;
  long long res = 0;
  if (L <= mid) res += query(rt << 1, L, R);
  if (R > mid) res += query(rt << 1 | 1, L, R);
  return res;
}
int all;
int pre[2 * MaxN + 5], last[MaxN + 5], other[2 * MaxN + 5];
long long ans[MaxN + 5];
struct Add {
  int d;
  long long val;
  Add() {}
  Add(int _d, long long _val) {
    d = _d;
    val = _val;
  }
};
vector<Add> A[MaxN + 5];
void build(int x, int y) {
  pre[++all] = last[x];
  last[x] = all;
  other[all] = y;
}
void Dfs(int x, int fa, int dep) {
  int sz = A[x].size();
  for (int i = 0; i < sz; i++)
    update(1, dep, min(n, dep + A[x][i].d), A[x][i].val);
  ans[x] = query(1, dep, dep);
  for (int ed = last[x]; ed != -1; ed = pre[ed]) {
    int dr = other[ed];
    if (dr != fa) Dfs(dr, x, dep + 1);
  }
  for (int i = 0; i < sz; i++)
    update(1, dep, min(n, dep + A[x][i].d), -A[x][i].val);
}
int main() {
  while (scanf("%d", &n) != EOF) {
    Build(1, 1, n);
    all = -1;
    memset(last, -1, sizeof(last));
    for (int i = 1; i < n; i++) {
      int u, v;
      scanf("%d %d", &u, &v);
      build(u, v);
      build(v, u);
    }
    scanf("%d", &Q);
    while (Q--) {
      int v, d;
      long long x;
      scanf("%d %d %lld", &v, &d, &x);
      A[v].push_back(Add(d, x));
    }
    Dfs(1, 0, 1);
    for (int i = 1; i <= n; i++) {
      if (i == n)
        printf("%lld\n", ans[i]);
      else
        printf("%lld ", ans[i]);
    }
  }
  return 0;
}
