#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int MAXN = 3e5 + 10;
const int MAXM = 2e5 + 10;
const long long mod = 1e9 + 7;
vector<int> vec[MAXN];
vector<pair<int, int> > q[MAXN];
int h = -1;
long long ans[MAXN], dep[MAXN], now = 0;
void dfs(int u, int fa) {
  h++;
  now += dep[h];
  for (int i = 0; i < q[u].size(); i++) {
    int d = q[u][i].first, x = q[u][i].second;
    now += x;
    if (h + d + 1 < MAXN) dep[h + d + 1] -= x;
  }
  ans[u] += now;
  for (int i = 0; i < vec[u].size(); i++) {
    int v = vec[u][i];
    if (v == fa) continue;
    dfs(v, u);
  }
  for (int i = 0; i < q[u].size(); i++) {
    int d = q[u][i].first, x = q[u][i].second;
    now -= x;
    if (h + d + 1 < MAXN) dep[h + d + 1] += x;
  }
  now -= dep[h];
  h--;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    vec[u].push_back(v);
    vec[v].push_back(u);
  }
  int m;
  scanf("%d", &m);
  while (m--) {
    int v, d, x;
    scanf("%d%d%d", &v, &d, &x);
    q[v].push_back(make_pair(d, x));
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
  return 0;
}
