#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  long long res = 1LL;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
long long inv(long long n) { return power(n, 1000000007 - 2) % 1000000007; }
long long isprime(long long n) {
  if (n < 2) return 0;
  long long i;
  for (i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long sq(long long n) { return n * n; }
const long long N = 3e5 + 10;
long long n;
vector<long long> a[N];
long long res[N], i, j, x, y, ans = 0, d[N];
vector<pair<long long, long long> > op[N];
void dfs(long long v, long long par, long long dep) {
  for (auto [di, x] : op[v]) {
    ans += x;
    if (dep + di + 1 <= N) d[dep + 1 + di] += x;
  }
  ans -= d[dep];
  res[v] = ans;
  for (auto x : a[v]) {
    if (x == par) continue;
    dfs(x, v, dep + 1);
  }
  ans += d[dep];
  for (auto [di, x] : op[v]) {
    ans -= x;
    if (dep + 1 + di <= N) d[dep + 1 + di] -= x;
  }
}
void solve() {
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  long long q;
  cin >> q;
  while (q--) {
    long long v, d, x;
    cin >> v >> d >> x;
    op[v].push_back({d, x});
  }
  dfs(1, 0, 0);
  for (i = 1; i <= n; i++) cout << res[i] << " ";
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  long long tc = 0;
  while (t--) {
    tc++;
    solve();
  }
}
