#include <bits/stdc++.h>
using namespace std;
using namespace std;
pair<double, double> arr[100005];
const int maxn = 500009;
vector<int> tree[maxn];
long long bit[maxn];
long long ans[maxn];
vector<pair<int, int> > queries[maxn];
void add(int ind, long long x) {
  ind++;
  while (ind < maxn) {
    bit[ind] += 1ll * x;
    ind += ind & -ind;
  }
}
long long sum(int ind) {
  ind++;
  long long second = 0;
  while (ind > 0) {
    second += 1ll * bit[ind];
    ind -= ind & -ind;
  }
  return second;
}
void dfs(int u, int p, int d) {
  for (int i = 0; i < ((int)((queries[u]).size())); i++) {
    pair<int, int> cur = queries[u][i];
    add(d, cur.second);
    add(d + cur.first + 1, -cur.second);
  }
  ans[u] = sum(d);
  for (int i = 0; i < ((int)((tree[u]).size())); i++) {
    int v = tree[u][i];
    if (v == p) {
      continue;
    }
    dfs(v, u, d + 1);
  }
  for (int i = 0; i < ((int)((queries[u]).size())); i++) {
    pair<int, int> cur = queries[u][i];
    add(d, -cur.second);
    add(d + cur.first + 1, cur.second);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u, --v;
    tree[u].push_back(v);
    tree[v].push_back(u);
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int v, d, x;
    scanf("%d %d %d", &v, &d, &x);
    --v;
    d = min(d, maxn - 10);
    queries[v].push_back(pair<int, int>(d, x));
  }
  dfs(0, -1, 0);
  for (int i = 0; i < n; ++i) {
    printf("%lld ", ans[i]);
  }
}
