#include <bits/stdc++.h>
using namespace std;
long long tree[300005], ans[300005];
int depth[300005], n;
vector<int> v[300005];
vector<pair<int, long long> > pro[300005];
void update(int pos, long long val) {
  while (pos <= n) {
    tree[pos] += val;
    pos += (pos & -pos);
  }
}
long long read(int pos) {
  long long sum = 0;
  while (pos > 0) {
    sum += tree[pos];
    pos -= (pos & -pos);
  }
  return sum;
}
void dfs(int src, int par) {
  depth[src] = depth[par] + 1;
  for (int i = 0; i < pro[src].size(); i++) {
    int x = pro[src][i].first;
    long long y = pro[src][i].second;
    update(depth[src], y);
    update(depth[src] + x + 1, -y);
  }
  ans[src] += read(depth[src]);
  for (int i = 0; i < v[src].size(); i++) {
    int x = v[src][i];
    if (x != par) dfs(x, src);
  }
  for (int i = 0; i < pro[src].size(); i++) {
    int x = pro[src][i].first;
    long long y = pro[src][i].second;
    update(depth[src], -y);
    update(depth[src] + x + 1, y);
  }
}
int main() {
  int i, j, d, a, b;
  long long x, y;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d %d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    scanf("%d %d %lld", &a, &d, &x);
    pro[a].push_back({d, x});
  }
  dfs(1, 0);
  for (i = 1; i <= n; i++) {
    printf("%lld ", ans[i]);
  }
}
