#include <bits/stdc++.h>
using namespace std;
const int N = int(3e5) + 9;
int n, m;
vector<int> g[N];
vector<pair<int, int> > q[N];
long long add[N];
long long res[N];
void dfs(int v, int pr, int h, long long sum) {
  for (auto p : q[v]) {
    int l = h, r = h + p.first;
    add[l] += p.second;
    if (r + 1 < N) add[r + 1] -= p.second;
  }
  sum += add[h];
  res[v] = sum;
  for (auto to : g[v])
    if (to != pr) dfs(to, v, h + 1, sum);
  for (auto p : q[v]) {
    int l = h, r = h + p.first;
    add[l] -= p.second;
    if (r + 1 < N) add[r + 1] += p.second;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int v, h, d;
    scanf("%d %d %d", &v, &h, &d);
    --v;
    q[v].push_back(make_pair(h, d));
  }
  dfs(0, 0, 0, 0);
  for (int i = 0; i < n; ++i) printf("%lld ", res[i]);
  puts("");
  return 0;
}
