#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
long long ans[N], tr[N];
vector<int> E[N];
vector<pair<int, long long> > q[N];
int n, m, u, v;
int V, d, x;
void add(int x, int v) {
  for (int i = x; i <= n + 1; i += i & -i) tr[i] += v;
}
long long sum(int x) {
  long long ans = 0;
  for (int i = x; i > 0; i -= i & -i) ans += tr[i];
  return ans;
}
void dfs(int u, int fa, int dep) {
  for (int i = 0; i < q[u].size(); ++i) {
    int d = q[u][i].first;
    int v = q[u][i].second;
    add(dep, v);
    add(min(n + 1, dep + d + 1), -v);
  }
  ans[u] = sum(dep);
  for (int i = 0; i < E[u].size(); ++i) {
    int v = E[u][i];
    if (v == fa) continue;
    dfs(v, u, dep + 1);
  }
  for (int i = 0; i < q[u].size(); ++i) {
    int d = q[u][i].first;
    int v = q[u][i].second;
    add(dep, -v);
    add(min(n + 1, dep + d + 1), v);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    E[u].push_back(v);
    E[v].push_back(u);
  }
  scanf("%d", &m);
  while (m--) {
    scanf("%d%d%d", &x, &d, &V);
    q[x].push_back(pair<int, long long>(d, V));
  }
  dfs(1, 0, 1);
  for (int i = 1; i <= n; ++i) printf("%I64d%c", ans[i], i == n ? '\n' : ' ');
  return 0;
}
