#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> adj(n);
  for (int i = 1, u, v; i < n; ++i) {
    cin >> u >> v;
    adj[--u].push_back(--v);
    adj[v].push_back(u);
  }
  vector<vector<pair<int, int>>> upd(n);
  int q;
  cin >> q;
  vector<long long> ans(n);
  for (int u, d, x; q--;) {
    cin >> u >> d >> x;
    d = min(d, n);
    if (d == 0)
      ans[--u] += x;
    else
      upd[--u].push_back({d, x});
  }
  vector<long long> f(n + 1);
  auto update = [&](int p, int x) {
    for (; p <= n; p += p & -p) f[p] += x;
  };
  auto query = [&](int p) {
    long long s = 0;
    for (; p > 0; p -= p & -p) s += f[p];
    return s;
  };
  function<void(int, int, int)> dfs = [&](int u, int p, int l) {
    for (auto &i : upd[u])
      i.first = min(n, i.first + l), update(i.first, i.second);
    ans[u] += query(n) - query(l - 1);
    for (auto v : adj[u])
      if (v != p) dfs(v, u, l + 1);
    for (auto &i : upd[u]) update(i.first, -i.second);
  };
  dfs(0, -1, 0);
  for (auto &i : ans) cout << i << " \n"[&i == &ans.back()];
  return 0;
}
