#include <bits/stdc++.h>
using namespace std;
void DFS(long, long, long, long long);
vector<vector<long>> Adj;
vector<vector<pair<long, long>>> QueryList;
vector<long long> Result;
vector<long long> Delta;
long N, M;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  Adj.resize(N + 2);
  for (long i = 1, u, v; i < N; ++i) {
    cin >> u >> v;
    Adj[u].push_back(v);
    Adj[v].push_back(u);
  }
  cin >> M;
  QueryList.resize(N + 2);
  for (long i = 0, u, l, v; i < M; ++i) {
    cin >> u >> l >> v;
    QueryList[u].push_back({l, v});
  }
  Result.resize(N + 2);
  Delta.resize(N + 2);
  DFS(1, 1, 1, 0LL);
  for (long i = 1; i <= N; ++i) cout << Result[i] << ' ';
  return 0;
}
void DFS(long u, long Parent, long Height, long long CurSum) {
  for (pair<long, long> X : QueryList[u]) {
    Delta[Height] += X.second;
    if (Height + X.first + 1 <= N) Delta[Height + X.first + 1] -= X.second;
  }
  CurSum += Delta[Height];
  Result[u] = CurSum;
  for (long v : Adj[u])
    if (v != Parent) DFS(v, u, Height + 1, CurSum);
  for (pair<long, long> X : QueryList[u]) {
    Delta[Height] -= X.second;
    if (Height + X.first + 1 <= N) Delta[Height + X.first + 1] += X.second;
  }
}
