#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int n, m;
vector<int> D[maxn], X[maxn], G[maxn];
long long add[maxn];
long long ans[maxn];
void dfs(int v, int pre, int h, long long sum) {
  for (int i = 0; i < D[v].size(); i++) {
    int l = h, r = h + D[v][i];
    add[l] += X[v][i];
    if (r + 1 < maxn) add[r + 1] -= X[v][i];
  }
  sum += add[h];
  ans[v] = sum;
  for (int i = 0; i < G[v].size(); i++) {
    if (G[v][i] != pre) dfs(G[v][i], v, h + 1, sum);
  }
  for (int i = 0; i < D[v].size(); i++) {
    int l = h, r = h + D[v][i];
    add[l] -= X[v][i];
    if (r + 1 < maxn) add[r + 1] += X[v][i];
  }
}
void init(int n) {
  for (int i = 1; i <= n; i++) {
    G[i].clear();
    D[i].clear();
    X[i].clear();
  }
  memset(add, 0, sizeof(add));
  memset(ans, 0, sizeof(ans));
}
int main() {
  ios::sync_with_stdio(false);
  while (cin >> n) {
    init(n);
    for (int i = 1; i < n; i++) {
      int u, v;
      cin >> u >> v;
      G[u].push_back(v);
      G[v].push_back(u);
    }
    cin >> m;
    for (int i = 1; i <= m; ++i) {
      int v, d, x;
      cin >> v >> d >> x;
      D[v].push_back(d);
      X[v].push_back(x);
    }
    dfs(1, 0, 0, 0);
    for (int i = 1; i <= n; ++i) {
      if (i != n)
        cout << ans[i] << " ";
      else
        cout << ans[i] << endl;
    }
  }
  return 0;
}
