#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[300005];
vector<pair<long long, long long>> add[300005];
bool visited[300005];
long long dl[300005], ans[300005];
void dfs(long long src, long long sum, long long level) {
  visited[src] = true;
  long long sum1 = sum;
  for (auto it : add[src]) {
    dl[level] += it.second;
    if (level + it.first + 1 <= 300004) dl[level + it.first + 1] -= it.second;
  }
  sum1 += dl[level];
  ans[src] = sum1;
  for (auto it : adj[src]) {
    if (visited[it] == false) {
      dfs(it, sum1, level + 1);
    }
  }
  for (auto it : add[src]) {
    dl[level] -= it.second;
    if (level + it.first + 1 <= 300004) dl[level + it.first + 1] += it.second;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, x, y, v, d;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> v >> d >> x;
    add[v].push_back(make_pair(d, x));
  }
  dfs(1, 0, 0);
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
  return 0;
}
