#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n, cnt;
int a[maxn], h[maxn], tin[maxn], tout[maxn], pos[maxn];
vector<int> adj[maxn], level[maxn];
pair<int, pair<int, int> > qr[maxn + maxn];
long long res[maxn], t[maxn];
void Input() {
  cin >> n;
  int x, y;
  for (int i = (1); i <= (n - 1); ++i) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
}
void DFS(int u) {
  tin[u] = ++cnt;
  level[h[u]].push_back(u);
  int v;
  for (int i = 0; i < ((int)adj[u].size()); ++i) {
    v = adj[u][i];
    if (h[v] != 0) continue;
    h[v] = h[u] + 1;
    DFS(v);
  }
  tout[u] = cnt;
}
void update(int x, int val) {
  for (; x <= n; x += x & -x) t[x] += val;
}
long long get(int x) {
  long long res = 0;
  for (; x > 0; x -= x & -x) res += t[x];
  return res;
}
void Solve() {
  h[1] = 1;
  DFS(1);
  int lim = 0;
  for (int i = (1); i <= (n + 1); ++i)
    if (level[i].empty()) {
      lim = i - 1;
      break;
    }
  int m, magic = 0;
  cin >> m;
  for (int i = (1); i <= (m); ++i) {
    int u, d, x;
    cin >> u >> d >> x;
    qr[++magic] = make_pair(h[u], make_pair(u, x));
    int nxt = min(d + h[u], lim) + 1;
    qr[++magic] = make_pair(nxt, make_pair(u, -x));
  }
  m = magic;
  sort(qr + 1, qr + 1 + m);
  int l = 1;
  for (int i = (1); i <= (lim); ++i) {
    while (l <= m && qr[l].first <= i) {
      int u = qr[l].second.first, x = qr[l].second.second;
      update(tin[u], x);
      update(tout[u] + 1, -x);
      ++l;
    }
    for (int v : level[i]) res[v] = get(tin[v]);
  }
  for (int i = (1); i <= (n); ++i) cout << res[i] << ' ';
}
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  Input();
  Solve();
  return 0;
}
