#include <bits/stdc++.h>
using namespace std;
const long long MAX = 500020;
const long long MOD = (long long)1e9 + 7;
const long long INF = 1e9;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-7;
vector<long long> g[MAX];
long long res[MAX], delta[MAX];
vector<pair<long long, long long> > queries[MAX];
void dfs(long long u, long long p, long long depth, long long val) {
  for (auto q : queries[u]) {
    long long d, x;
    tie(d, x) = q;
    delta[depth] += x;
    delta[min(depth + d + 1, MAX - 1)] -= x;
  }
  val += delta[depth];
  res[u] = val;
  for (auto prox : g[u]) {
    if (prox == p) continue;
    dfs(prox, u, depth + 1, val);
  }
  for (auto q : queries[u]) {
    long long d, x;
    tie(d, x) = q;
    delta[depth] -= x;
    delta[min(depth + d + 1, MAX - 1)] += x;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, q;
  cin >> n;
  for (long long i = 0; i < (long long)n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  cin >> q;
  for (long long i = 0; i < (long long)q; i++) {
    long long v, d, x;
    cin >> v >> d >> x;
    queries[v].push_back(make_pair(d, x));
  }
  dfs(1, 1, 0, 0);
  for (long long i = 1; i <= n; i++) {
    cout << res[i] << " ";
  }
  cout << '\n';
  return 0;
}
