#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 100;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
vector<int> g[maxn];
vector<pair<int, int> > q[maxn];
long long ans[maxn * 2];
long long loss[maxn * 2];
void dfs(int u, int p, long long sum, int height) {
  for (int i = 0; i < q[u].size(); i++) {
    int d = q[u][i].first;
    int x = q[u][i].second;
    sum += x;
    loss[height + d] += x;
  }
  ans[u] = sum;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == p) {
      continue;
    }
    dfs(v, u, sum - loss[height], height + 1);
  }
  for (int i = 0; i < q[u].size(); i++) {
    int d = q[u][i].first;
    int x = q[u][i].second;
    loss[height + d] -= x;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int v, d, x;
    cin >> v >> d >> x;
    v--;
    d = min(d, n);
    q[v].push_back({d, x});
  }
  dfs(0, -1, 0, 0);
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
