#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long N = 3e5 + 10;
const long long mod = 1000000007;
long long n, m;
vector<long long> G[N];
vector<pair<long long, long long> > Query[N];
long long diff[N];
long long ans[N];
void dfs(long long v, long long par = -1, long long height = 0,
         long long prev = 0) {
  for (auto p : Query[v]) {
    long long l = height;
    long long r = l + p.first;
    diff[l] += p.second;
    if (r + 1 < N) diff[r + 1] -= p.second;
  }
  prev += diff[height];
  ans[v] = prev;
  for (auto to : G[v]) {
    if (to == par) continue;
    dfs(to, v, height + 1, prev);
  }
  for (auto p : Query[v]) {
    long long l = height;
    long long r = l + p.first;
    diff[l] -= p.second;
    if (r + 1 < N) diff[r + 1] += p.second;
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    --u;
    --v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  cin >> m;
  for (long long i = 0; i < m; i++) {
    long long v, h, d;
    cin >> v >> h >> d;
    --v;
    Query[v].push_back(make_pair(h, d));
  }
  dfs(0);
  for (long long i = 0; i < n; i++) cout << ans[i] << " ";
  return 0;
}
