#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
vector<long long> v[300005LL];
vector<pair<long long, long long> > qr[300005LL];
long long upd[300005LL], res[300005LL];
void dfs(long long cur, long long par, long long height, long long sum) {
  for (auto x : qr[cur]) {
    long long l = height, r = min(height + x.first + 1, 300005LL);
    upd[l] += x.second;
    upd[r] -= x.second;
  }
  sum += upd[height];
  res[cur] = sum;
  for (long long x : v[cur]) {
    if (x == par) continue;
    dfs(x, cur, height + 1, sum);
  }
  for (auto x : qr[cur]) {
    long long l = height, r = min(height + x.first + 1, 300005LL);
    upd[l] -= x.second;
    upd[r] += x.second;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long v, h, d;
    cin >> v >> h >> d;
    qr[v].push_back(make_pair(h, d));
  }
  dfs(1, 1, 0, 0);
  for (long long i = 1; i <= n; i++) cout << res[i] << " ";
}
