#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
long long w[N], c[N];
int n;
int st[N], ed[N], p[N], dep[N], res = 0;
int to[N << 1], nt[N << 1], head[N], cnt = 0;
void add(int x, int y) {
  to[++cnt] = y;
  nt[cnt] = head[x];
  head[x] = cnt;
}
void predfs(int u, int fa) {
  st[u] = ++res;
  dep[u] = dep[fa] + 1;
  for (int i = head[u]; i; i = nt[i]) {
    if (to[i] == fa) continue;
    predfs(to[i], u);
  }
  ed[u] = res;
}
int findr(int be, int d) {
  int l = 1, r = n, ans = n + 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (dep[p[mid]] > d)
      r = mid - 1;
    else if (dep[p[mid]] < d)
      l = mid + 1;
    else if (st[p[mid]] <= be)
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return ans;
}
int findl(int be, int d) {
  int l = 1, r = n, ans = n + 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (dep[p[mid]] > d)
      r = mid - 1;
    else if (dep[p[mid]] < d)
      l = mid + 1;
    else if (st[p[mid]] >= be)
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  return ans;
}
void upd(int l, int r, int d, int val) {
  int L = findl(l, d), R = findr(r, d);
  if (L <= n && dep[p[L]] == d && st[p[L]] <= r) c[L] += val;
  if (R <= n && dep[p[R]] == d && st[p[R]] >= l) c[R + 1] -= val;
}
void dfs(int u, int fa) {
  for (int i = head[u]; i; i = nt[i]) {
    if (to[i] == fa) continue;
    w[to[i]] += w[u];
    dfs(to[i], u);
  }
}
bool cmp(int x, int y) {
  if (dep[x] == dep[y])
    return st[x] < st[y];
  else
    return dep[x] < dep[y];
}
int main() {
  scanf("%d", &n);
  for (int i = 2, x, y; i <= n; ++i) {
    scanf("%d%d", &x, &y);
    add(x, y), add(y, x);
  }
  predfs(1, 0);
  for (int i = 1; i <= n; ++i) p[i] = i;
  sort(p + 1, p + 1 + n, cmp);
  int m;
  scanf("%d", &m);
  for (int o = 1, x, y, z; o <= m; ++o) {
    scanf("%d%d%d", &x, &y, &z);
    w[x] += z;
    upd(st[x], ed[x], dep[x] + y + 1, -z);
  }
  for (int i = 1; i <= n; ++i) {
    c[i] += c[i - 1];
    w[p[i]] += c[i];
  }
  dfs(1, 0);
  for (int i = 1; i <= n; ++i) printf("%lld\n", w[i]);
  return 0;
}
