#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int dep[MAXN];
long long ans[MAXN];
vector<int> nei[MAXN];
vector<pair<int, long long> > q[MAXN];
bool used[MAXN];
void DFS_dep(int u);
void DFS(int u);
int main() {
  int Q, n, u, v, d, x;
  cin >> n;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    nei[u].push_back(v);
    nei[v].push_back(u);
  }
  dep[1] = 0;
  DFS_dep(1);
  for (int u = 1; u <= n; u++) used[u] = false;
  cin >> Q;
  while (Q--) {
    scanf("%d%d%d", &v, &d, &x);
    q[v].push_back(make_pair(d, x));
  }
  DFS(1);
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << '\n';
  char I;
  cin >> I;
  return 0;
}
void DFS_dep(int u) {
  used[u] = true;
  for (int i = 0; i < nei[u].size(); i++) {
    int to = nei[u][i];
    if (used[to]) continue;
    dep[to] = dep[u] + 1;
    DFS_dep(to);
  }
}
long long del[MAXN];
long long cur_sum;
void DFS(int u) {
  used[u] = true;
  for (int i = 0; i < q[u].size(); i++) {
    cur_sum += q[u][i].second;
    if (dep[u] + q[u][i].first + 1 <= 300000)
      del[dep[u] + q[u][i].first + 1] += q[u][i].second;
  }
  cur_sum -= del[dep[u]];
  ans[u] += cur_sum;
  for (int i = 0; i < nei[u].size(); i++)
    if (!used[nei[u][i]]) DFS(nei[u][i]);
  cur_sum += del[dep[u]];
  for (int i = 0; i < q[u].size(); i++) {
    cur_sum -= q[u][i].second;
    if (dep[u] + q[u][i].first + 1 <= 300000)
      del[dep[u] + q[u][i].first + 1] -= q[u][i].second;
  }
}
