#include <bits/stdc++.h>
struct L {
  struct L *next;
  int j;
};
struct V {
  struct L adj;
  int a, b, d;
  long long ans;
} vv[300000];
void link(int i, int j) {
  static struct L ll_[300000 * 2], *l = ll_;
  l->j = j;
  l->next = vv[i].adj.next;
  vv[i].adj.next = l++;
}
int t;
void dfs(int p, int i, int d) {
  struct V *u = &vv[i];
  struct L *l;
  u->d = d;
  u->a = t++;
  for (l = u->adj.next; l; l = l->next)
    if (l->j != p) dfs(i, l->j, d + 1);
  u->b = t;
}
struct Q {
  int t, l, r, d, x, i;
} qq[300000 + 300000];
int compare(const void *a, const void *b) {
  struct Q *p = (struct Q *)a;
  struct Q *q = (struct Q *)b;
  return p->d != q->d ? q->d - p->d : p->t - q->t;
}
long long tt[300000];
void update(int i, int n, int x) {
  while (i < n) {
    tt[i] += x;
    i |= i + 1;
  }
}
long long query(int i) {
  long long sum = 0;
  while (i >= 0) {
    sum += tt[i];
    i &= i + 1;
    i--;
  }
  return sum;
}
int main() {
  int n, m, h, i, j;
  scanf("%d", &n);
  for (h = 0; h < n - 1; h++) {
    scanf("%d%d", &i, &j);
    i--, j--;
    link(i, j);
    link(j, i);
  }
  dfs(-1, 0, 0);
  scanf("%d", &m);
  for (h = 0; h < m; h++) {
    struct Q *q = &qq[h];
    int d, x;
    scanf("%d%d%d", &i, &d, &x);
    i--;
    q->t = 0;
    q->l = vv[i].a;
    q->r = vv[i].b;
    q->d = vv[i].d + d;
    q->x = x;
  }
  for (i = 0; i < n; i++) {
    struct Q *q = &qq[m + i];
    q->t = 1;
    q->d = vv[i].d;
    q->i = i;
  }
  m += n;
  qsort(qq, m, sizeof *qq, compare);
  for (h = 0; h < m; h++) {
    struct Q *q = &qq[h];
    if (q->t == 0)
      update(q->l, n, q->x), update(q->r, n, -q->x);
    else {
      struct V *u = &vv[q->i];
      u->ans = query(u->a);
    }
  }
  for (i = 0; i < n; i++) printf("%lld ", vv[i].ans);
  printf("\n");
  return 0;
}
