#include <bits/stdc++.h>
using namespace std;
const int nmax = 4e5;
long long foo[nmax], ans[nmax];
vector<vector<pair<long long, long long> > > q;
vector<vector<long long> > adj;
void add(long long idx, long long val) {
  for (++idx; idx < nmax; idx += idx & -idx) foo[idx] += val;
}
void range_add(long long l, long long r, long long val) {
  add(l, val);
  add(r + 1, -val);
}
long long point_query(long long idx) {
  long long ret = 0;
  for (++idx; idx > 0; idx -= idx & -idx) ret += foo[idx];
  return ret;
}
void dfs(long long v = 0, long long p = -1, long long d = 0) {
  for (auto &query : q[v]) {
    query.second = min(query.second, nmax - 100 - d);
    range_add(d, d + query.second, query.first);
  }
  ans[v] = point_query(d);
  for (auto it : adj[v]) {
    if (it ^ p) {
      dfs(it, v, d + 1);
    }
  }
  for (auto &query : q[v]) {
    range_add(d, d + query.second, -1 * query.first);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, x, t, m, y, z;
  cin >> n;
  adj.resize(n);
  q.resize(n);
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y, x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  cin >> m;
  for (int j = 0; j < m; j++) {
    cin >> x >> y >> z;
    x--;
    q[x].push_back(make_pair(z, y));
  }
  dfs();
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
