#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
long long n, m;
long long bit[N], val[N];
vector<long long> g[N];
vector<pair<long long, long long> > q[N];
void update(long long idx, long long val) {
  idx = N - 1 - idx;
  while (idx < N) {
    bit[idx] += val;
    idx += idx & -idx;
  }
}
long long pref(long long idx) {
  idx = N - 1 - idx;
  long long ans = 0;
  while (idx > 0) {
    ans += bit[idx];
    idx -= idx & -idx;
  }
  return ans;
}
void dfs(long long k, long long par, long long lvl) {
  for (auto &it : q[k]) update(lvl + it.first, it.second);
  val[k] = pref(lvl);
  for (auto &it : g[k]) {
    if (it == par) continue;
    dfs(it, k, lvl + 1);
  }
  for (auto &it : q[k]) update(lvl + it.first, -it.second);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  cin >> m;
  for (long long i = 1; i <= m; i++) {
    long long v, d, x;
    cin >> v >> d >> x;
    d = min(n, d);
    q[v].push_back({d, x});
  }
  dfs(1, 1, 1);
  for (long long i = 1; i <= n; i++) cout << val[i] << " ";
  return 0;
}
