#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > adj;
vector<pair<long long, long long> > nodo[300005];
long long res[300005], tree[300005];
void add(long long pos, long long x) {
  for (long long i = pos; i <= 300000; i += i & (-i)) tree[i] += x;
}
long long query(long long pos) {
  long long res = 0;
  for (long long i = pos; i >= 1; i -= i & (-i)) res += tree[i];
  return res;
}
void solve(long long u, long long p, long long dep) {
  for (auto par : nodo[u]) {
    add(dep, par.second);
    add(dep + par.first + 1, -par.second);
  }
  res[u] = query(dep);
  for (long long v : adj[u])
    if (v != p) solve(v, u, dep + 1);
  for (auto par : nodo[u]) {
    add(dep, -par.second);
    add(dep + par.first + 1, par.second);
  }
}
int main() {
  cout.sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  adj.assign(n + 5, vector<long long>());
  for (long long i = 0; i < n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  long long q;
  cin >> q;
  while (q--) {
    long long u, d, x;
    cin >> u >> d >> x;
    nodo[u].push_back({d, x});
  }
  solve(1, 0, 1);
  for (long long i = 1; i <= n; i++) cout << res[i] << " ";
  cout << endl;
  return 0;
}
