#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > g;
vector<vector<pair<long long, long long> > > updates;
vector<long long> tree;
vector<long long> ans;
long long n;
void update(long long v, long long l, long long r, long long al, long long ar,
            long long val) {
  if (al <= l && ar >= r) {
    tree[v] += val;
    return;
  }
  if (al <= r && ar >= l) {
    update(v * 2, l, (r + l) / 2, al, ar, val);
    update(v * 2 + 1, (r + l) / 2 + 1, r, al, ar, val);
  }
}
long long answer(long long v, long long l, long long r, long long ind) {
  if (l == r) {
    return tree[v];
  }
  if (ind <= (r + l) / 2) {
    return tree[v] + answer(v * 2, l, (r + l) / 2, ind);
  } else {
    return tree[v] + answer(v * 2 + 1, (r + l) / 2 + 1, r, ind);
  }
}
void dfs(long long v, long long pred = -1, long long h = 0) {
  for (long long i = 0; i < updates[v].size(); i++) {
    update(1, 0, n - 1, h, min(updates[v][i].second + h, n),
           updates[v][i].first);
  }
  ans[v] = answer(1, 0, n - 1, h);
  for (long long i = 0; i < g[v].size(); i++) {
    if (g[v][i] != pred) {
      dfs(g[v][i], v, h + 1);
    }
  }
  for (long long i = 0; i < updates[v].size(); i++) {
    update(1, 0, n - 1, h, min(updates[v][i].second + h, n),
           -updates[v][i].first);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  tree.resize(n * 4);
  g.resize(n);
  ans.resize(n);
  updates.resize(n);
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  long long m;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    long long v, x, d;
    cin >> v >> d >> x;
    v--;
    updates[v].push_back({x, d});
  }
  dfs(0);
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
