#include <bits/stdc++.h>
using namespace std;
struct bit {
  long long MAXN;
  vector<long long> BIT;
  void build() {
    for (long long i = 0; i < MAXN; i++) BIT.push_back(0);
  }
  void update(long long x, long long v) {
    for (; x < MAXN; x += x & -x) {
      BIT[x] += v;
    }
  }
  long long query(long long x) {
    long long sum = 0;
    for (; x > 0; x -= x & -x) sum += BIT[x];
    return sum;
  }
  void update(long long l, long long r, long long v) {
    update(l, v);
    update(r + 1, -v);
  }
} everylevel[300005];
vector<long long> graph[300005];
long long level[300005], st[300005], en[300005], parent[300005],
    maxlevel[300005];
vector<long long> lev_nod[300005];
bool cmp(long long a, long long b) {
  if (st[a] < st[b]) return 1;
  return 0;
}
long long n, q, timerr = 1;
void dfs(long long src, long long par, long long lev) {
  level[src] = lev;
  maxlevel[src] = lev;
  parent[src] = par;
  st[src] = timerr++;
  lev_nod[lev].push_back(src);
  for (long long i = 0; i < graph[src].size(); i++) {
    long long adj = graph[src][i];
    if (adj != par) {
      dfs(adj, src, lev + 1);
      maxlevel[src] = max(maxlevel[src], maxlevel[adj]);
    }
  }
  en[src] = timerr++;
}
long long binar_low(long long now_level, long long val) {
  long long low = 0;
  long long high = lev_nod[now_level].size() - 1;
  long long ans = -1;
  long long mid, now_node;
  while (low <= high) {
    mid = (low + high) / 2;
    now_node = lev_nod[now_level][mid];
    if (st[now_node] >= val) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return ans;
}
long long binar_high(long long now_level, long long val) {
  long long low = 0;
  long long high = lev_nod[now_level].size() - 1;
  long long ans = -1;
  long long mid, now_node;
  while (low <= high) {
    mid = (low + high) / 2;
    now_node = lev_nod[now_level][mid];
    if (st[now_node] <= val) {
      ans = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  return ans;
}
long long prop[300005];
void dfs2(long long src, long long par) {
  if (par != -1) prop[src] += prop[par];
  for (long long i = 0; i < graph[src].size(); i++) {
    long long adj = graph[src][i];
    if (adj != par) dfs2(adj, src);
  }
}
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n - 1; i++) {
    long long u, v;
    scanf("%lld", &u);
    scanf("%lld", &v);
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  dfs(1, -1, 0);
  for (long long i = 0; i <= n; i++) {
    if (lev_nod[i].size() == 0) break;
    everylevel[i].MAXN = ((long long)(lev_nod[i].size())) + 3;
    everylevel[i].build();
    sort(lev_nod[i].begin(), lev_nod[i].end(), cmp);
  }
  scanf("%lld", &q);
  for (long long i = 1; i <= q; i++) {
    long long v, d, x;
    scanf("%lld", &v);
    scanf("%lld", &d);
    scanf("%lld", &x);
    prop[v] += x;
    long long now_level = level[v] + d + 1;
    if (now_level > maxlevel[v]) continue;
    long long l = binar_low(now_level, st[v]);
    long long r = binar_high(now_level, en[v]);
    everylevel[now_level].update(l + 1, r + 1, -x);
  }
  for (long long i = 0; i <= n; i++) {
    if (lev_nod[i].size() == 0) break;
    for (long long j = 0; j < lev_nod[i].size(); j++) {
      long long now_nod = lev_nod[i][j];
      prop[now_nod] += everylevel[i].query(j + 1);
    }
  }
  dfs2(1, -1);
  for (long long i = 1; i <= n; i++) {
    if (i > 1) printf(" ");
    printf("%lld", prop[i]);
  }
  return 0;
}
