#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long long int inf = (long long int)1e15;
long long int power(long long int a, long long int b, long long int m = mod) {
  if (b == 0) return 1;
  if (b == 1) return (a % m);
  long long int x = power(a, b / 2, m);
  x = (x * x) % m;
  if (b % 2) x = (x * a) % m;
  return x;
}
const int N = 3e5 + 5;
int n, q;
vector<pair<long long int, long long int>> g[N];
vector<int> adj[N];
long long int ans[N], d[N];
int depth[N];
long long int acc = 0;
void dfs(int v, int p, int dep = 0) {
  for (auto it : g[v]) {
    acc += (it).second;
    if (dep + it.first + 1 < N) {
      d[dep + it.first + 1] += it.second;
    }
  }
  acc -= d[dep];
  ans[v] = acc;
  for (auto u : adj[v]) {
    if (u != p) {
      dfs(u, v, dep + 1);
    }
  }
  acc += d[dep];
  for (auto it : g[v]) {
    acc -= (it).second;
    if (dep + it.first + 1 < N) {
      d[dep + it.first + 1] -= it.second;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int ui, vi;
    cin >> ui >> vi;
    adj[ui].push_back(vi);
    adj[vi].push_back(ui);
  }
  cin >> q;
  while (q--) {
    int v, d, x;
    cin >> v >> d >> x;
    g[v].push_back(make_pair(d, x));
  }
  dfs(1, -1);
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
