#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int>> g;
vector<long long> ans;
vector<int> h;
vector<vector<pair<int, int>>> add;
struct FT {
  int n;
  vector<long long> ft;
  void init(int l) {
    n = l;
    ft.resize(n + 2);
  }
  void up(int p, long long val) {
    for (int i = p; i <= n; i += i & -i) ft[i] += val;
  }
  long long get(int p) {
    long long ans = 0;
    for (int i = p; i; i -= i & -i) ans += ft[i];
    return ans;
  }
} ft;
void cal(int u, int l) {
  if (h[u] != -1) return;
  h[u] = l;
  for (auto& i : add[u]) {
    int ul = min(n + 2, i.first + l);
    ft.up(ul, i.second);
  }
  ans[u] = ft.get(n + 2) - ft.get(l - 1);
  for (auto& i : g[u]) cal(i, l + 1);
  for (auto& i : add[u]) {
    int ul = min(n + 2, i.first + l);
    ft.up(ul, -i.second);
  }
}
void solve() {
  cin >> n;
  h.resize(n + 1, -1);
  ans.resize(n + 1);
  g.resize(n + 1);
  add.resize(n + 1);
  ft.init(n + 4);
  for (int i = 1; i < n; ++i) {
    int u, v, w;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int v, d, x;
    cin >> v >> d >> x;
    add[v].push_back({d, x});
  }
  cal(1, 1);
  for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
