#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
vector<int> adj[N];
struct Query {
  int x, d;
  Query() {}
  Query(int _x, int _d) {
    x = _x;
    d = _d;
  }
};
vector<Query> query[N];
int n, m;
void input() {
  scanf("%d", &n);
  for (int i = (1); i < (n); i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  scanf("%d", &m);
  for (int i = (0); i < (m); i++) {
    int u, d, x;
    scanf("%d %d %d", &u, &d, &x);
    query[u].push_back(Query(x, d));
  }
}
long long delta[N];
long long res[N];
void dfs(int u, int parent, int depth) {
  res[u] = res[parent] - delta[depth];
  depth++;
  for (Query &q : query[u]) {
    res[u] += q.x;
    int maxDepth = depth + q.d;
    if (maxDepth < n) {
      delta[maxDepth] += q.x;
    }
  }
  for (int &v : adj[u]) {
    if (v != parent) {
      dfs(v, u, depth);
    }
  }
  for (Query &q : query[u]) {
    int maxDepth = depth + q.d;
    if (maxDepth < n) {
      delta[maxDepth] -= q.x;
    }
  }
}
void solve() {
  dfs(1, 0, 0);
  for (int i = (1); i <= (n); i++) {
    printf("%lld ", res[i]);
  }
  printf("\n");
}
int main() {
  {
    input();
    solve();
  }
  return 0;
}
