#include <bits/stdc++.h>
using namespace std;
struct Query {
  int u, k, x;
};
vector<Query> Q[300010];
long long ADD[300010];
void dfs(int u, int p, vector<vector<int>> &adj, vector<long long> &A,
         int lvl = 0, long long s = 0) {
  int N = adj.size();
  for (Query q : Q[u]) {
    ADD[lvl] += q.x;
    ADD[min(lvl + q.k + 1, N + 3)] -= q.x;
  }
  s += ADD[lvl];
  A[u] = s;
  for (int v : adj[u]) {
    if (v == p) continue;
    dfs(v, u, adj, A, lvl + 1, s);
  }
  for (Query q : Q[u]) {
    ADD[lvl] -= q.x;
    ADD[min(lvl + q.k + 1, N + 3)] += q.x;
  }
}
int main() {
  int N;
  scanf("%d", &N);
  vector<vector<int>> adj(N);
  for (int i = 0; i < N - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  int M;
  scanf("%d", &M);
  for (int i = 0; i < M; ++i) {
    Query q;
    scanf("%d%d%d", &q.u, &q.k, &q.x);
    q.u--;
    Q[q.u].push_back(q);
  }
  vector<long long> A(N);
  dfs(0, -1, adj, A);
  for (long long a : A) {
    printf("%I64d ", a);
  }
  puts("");
  return 0;
}
