#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e9 + 9;
const long long MAXLL = 1e18 + 9;
const long long sz = 300006;
long long a[sz], b[sz], res[sz];
long long temp[sz];
std::vector<int> g[sz];
std::vector<pair<int, int>> q[sz];
int n;
void dfs(int v, int prev, int height, long long sum) {
  for (auto i : q[v]) {
    temp[height] += i.second;
    if (height + i.first + 1 <= n) temp[height + i.first + 1] -= i.second;
  }
  sum += temp[height];
  res[v] = sum;
  for (int i : g[v]) {
    if (i != prev) dfs(i, v, height + 1, sum);
  }
  for (auto i : q[v]) {
    temp[height] -= i.second;
    if (height + i.first + 1 <= n) temp[height + i.first + 1] += i.second;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int m, u, v, x, y, d;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int qry;
  cin >> qry;
  while (qry--) {
    cin >> v >> d >> x;
    q[v].push_back(make_pair(d, x));
  }
  dfs(1, 0, 0, 0);
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
}
