#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <class A>
ostream& operator<<(ostream& out, const vector<A>& a) {
  out << "[";
  for (auto it = a.begin(); it != a.end(); ++it) {
    if (it != a.begin()) out << ", ";
    out << *it;
  }
  return out << "]";
}
const int N = 300005;
long long a[N], seg[4 * N], lazy[4 * N], ans[N];
vector<pair<long long, long long> > v[N];
vector<long long> adj[N];
long long queryLazy(long long i, long long s, long long e, long long qs,
                    long long qe) {
  if (lazy[i] != 0) {
    seg[i] += (e - s + 1) * lazy[i];
    if (s != e) {
      lazy[2 * i + 1] += lazy[i];
      lazy[2 * i + 2] += lazy[i];
    }
    lazy[i] = 0;
  }
  if (qe < s || qs > e) return 0;
  if (s >= qs && e <= qe) return seg[i];
  long long mid = (s + e) / 2;
  long long left = queryLazy(2 * i + 1, s, mid, qs, qe);
  long long right = queryLazy(2 * i + 2, mid + 1, e, qs, qe);
  return (left + right);
}
void updateLazy(long long i, long long s, long long e, long long rs,
                long long re, long long inc) {
  if (lazy[i] != 0) {
    seg[i] += (e - s + 1) * lazy[i];
    if (s != e) {
      lazy[2 * i + 1] += lazy[i];
      lazy[2 * i + 2] += lazy[i];
    }
    lazy[i] = 0;
  }
  if (re < s || rs > e) return;
  if (rs <= s && re >= e) {
    seg[i] += (e - s + 1) * inc;
    if (s != e) {
      lazy[2 * i + 1] += inc;
      lazy[2 * i + 2] += inc;
    }
    return;
  }
  long long mid = (s + e) / 2;
  updateLazy(2 * i + 1, s, mid, rs, re, inc);
  updateLazy(2 * i + 2, mid + 1, e, rs, re, inc);
  seg[i] = (seg[2 * i + 1] + seg[2 * i + 2]);
}
void dfs(long long u, long long par, long long h) {
  for (auto p : v[u]) {
    updateLazy(0, 0, N - 5, h, h + p.first, p.second);
  }
  ans[u] = queryLazy(0, 0, N - 5, h, h);
  for (auto p : adj[u]) {
    if (p != par) dfs(p, u, h + 1);
  }
  for (auto p : v[u]) {
    updateLazy(0, 0, N - 5, h, h + p.first, -p.second);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, x, t, y, m, d;
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  cin >> m;
  while (m--) {
    cin >> y >> d >> x;
    v[y].push_back({d, x});
  }
  dfs(1, 0, 0);
  for (i = 1; i <= n; i++) cout << ans[i] << " ";
}
