#include <bits/stdc++.h>
using namespace std;
const long long mx = 3e5 + 5;
long long n, q, s[mx], val, dis[mx], temp, m[mx];
vector<int> adj[mx];
vector<pair<int, int> > vec[mx];
bool mark[mx];
void dfs(int v) {
  mark[v] = 1;
  for (auto i : vec[v]) {
    long long nd = i.first, x = i.second;
    val += x;
    nd += dis[v];
    if (nd < mx - 1) m[nd + 1] += x;
  }
  s[v] = val;
  s[v] -= m[dis[v]];
  val -= m[dis[v]];
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (!mark[u]) {
      dis[u] = dis[v] + 1;
      dfs(u);
    }
  }
  val += m[dis[v]];
  for (auto i : vec[v]) {
    long long nd = i.first, x = i.second;
    val -= x;
    nd += dis[v];
    if (nd < mx - 1) m[nd + 1] -= x;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int v, u;
    cin >> v >> u;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  cin >> q;
  for (int i = 0; i < q; i++) {
    int v, dis, va;
    cin >> v >> dis >> va;
    vec[v].push_back(make_pair(dis, va));
  }
  dfs(1);
  for (int i = 1; i <= n; i++) cout << s[i] << " ";
  return 0;
}
