#include <bits/stdc++.h>
using namespace std;
long long spf[31];
long long fac[31];
void sieve() {
  spf[1] = 1;
  for (long long i = 2; i < 31; i++) spf[i] = i;
  for (long long i = 4; i < 31; i += 2) spf[i] = 2;
  for (long long i = 3; i * i < 31; i++) {
    if (spf[i] == i) {
      for (long long j = i * i; j < 31; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
map<long long, long long> getfactor(long long a) {
  map<long long, long long> m;
  while (a > 1) {
    m[spf[a]]++;
    a /= spf[a];
  }
  return m;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long inverse(long long a, long long p) { return power(a, p - 2, p); }
long long ncr(long long n, long long r, long long p) {
  if (r > n) return 0;
  if (r == 0 || r == n) return 1;
  return (fac[n] * inverse(fac[r], p) % p * inverse(fac[n - r], p) % p) % p;
}
long long bit[1000001] = {0};
void update(long long ind, long long val) {
  while (ind <= 1000000) {
    bit[ind] += val;
    ind += ind & (-ind);
  }
}
long long get(long long ind) {
  long long tot = 0;
  while (ind > 0) {
    tot += bit[ind];
    ind -= ind & (-ind);
  }
  return tot;
}
vector<long long> v[300001];
map<long long, vector<pair<long long, long long> > > m;
long long ans[300001] = {0};
void dfs(long long cur, long long par, long long height) {
  for (auto it : m[cur]) {
    update(height, it.second);
    update(height + it.first + 1, -it.second);
  }
  for (auto it : v[cur]) {
    if (it != par) dfs(it, cur, height + 1);
  }
  ans[cur] = get(height);
  for (auto it : m[cur]) {
    update(height, -it.second);
    update(height + it.first + 1, it.second);
  }
}
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long ma;
  cin >> ma;
  while (ma--) {
    long long u, d, x;
    cin >> u >> d >> x;
    m[u].push_back(make_pair(d, x));
  }
  dfs(1, 1, 1);
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long test = 1;
  while (test--) {
    solve();
  }
}
