#include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 5;
const long long int infi = 1e18 + 5;
const long long int mod = 1e9 + 7;
vector<long long int> v[N];
vector<pair<long long int, long long int> > g[N];
long long int level[N];
long long int a[N];
long long int n, m, q;
void dfs(long long int val, long long int par, long long int h,
         long long int ans) {
  for (long long int i = 0; i < g[val].size(); i++) {
    long long int d = g[val][i].first;
    long long int x = g[val][i].second;
    level[h] += x;
    level[h + d + 1] -= x;
  }
  ans += level[h];
  a[val] = ans;
  for (long long int i = 0; i < v[val].size(); i++) {
    long long int it = v[val][i];
    if (it != par) {
      dfs(it, val, h + 1, ans);
    }
  }
  for (long long int i = 0; i < g[val].size(); i++) {
    long long int d = g[val][i].first;
    long long int x = g[val][i].second;
    level[h] = level[h] - x;
    level[h + d + 1] += x;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  long long int i, x, y;
  for (i = 1; i < n; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  cin >> q;
  while (q--) {
    long long int vv, dd, xx;
    cin >> vv >> dd >> xx;
    g[vv].push_back(make_pair(min(dd, n), xx));
  }
  long long int ans = 0;
  dfs(1, 0, 0, 0);
  for (i = 1; i <= n; i++) cout << a[i] << " ";
}
