#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
vector<int> g[MAXN];
vector<pair<int, int> > q[MAXN];
long long a[MAXN], d[MAXN];
int n, m;
void DFS(int u, int pre, int depth, long long cur) {
  for (auto &p : q[u])
    d[depth] += p.second, d[min(n, depth + p.first + 1)] -= p.second;
  cur += d[depth];
  a[u] = cur;
  for (auto &v : g[u])
    if (v != pre) DFS(v, u, depth + 1, cur);
  for (auto &p : q[u])
    d[depth] -= p.second, d[min(n, depth + p.first + 1)] += p.second;
  return;
}
int main() {
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; ++i)
    scanf("%d%d", &u, &v), g[u].push_back(v), g[v].push_back(u);
  scanf("%d", &m);
  for (int i = 0, v, d, x; i < m; ++i)
    scanf("%d%d%d", &v, &d, &x), q[v].emplace_back(d, x);
  DFS(1, 0, 0, 0);
  for (int i = 1; i <= n; ++i) printf("%lld%c", a[i], i == n ? '\n' : ' ');
  return 0;
}
