#include <bits/stdc++.h>
using namespace std;
bitset<300005> bs;
int n, m, a, b, vn, d;
long long x, val[300005], query[300005];
vector<int> v[300005];
vector<pair<int, long long> > q[300005];
void dfs(int nod, int nivel, long long toadd) {
  if (nod > n) return;
  long long crt = toadd;
  for (auto i : q[nod]) {
    query[min(nivel + i.first + 1, n + 1)] += -i.second;
    crt += i.second;
  }
  crt += query[nivel];
  val[nod] += crt;
  bs[nod] = 1;
  for (auto i : v[nod])
    if (!bs[i]) dfs(i, nivel + 1, crt);
  for (auto i : q[nod]) {
    query[min(nivel + i.first + 1, n + 1)] += i.second;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  cin >> m;
  while (m--) {
    cin >> vn >> d >> x;
    q[vn].push_back({d, x});
  }
  v[0].push_back(1);
  dfs(0, 0, 0);
  for (int i = 1; i <= n; ++i) cout << val[i] << ' ';
  return 0;
}
