#include <bits/stdc++.h>
using namespace std;
long long n, BIT[300005] = {0}, ans[300005] = {0};
vector<long long> v[300005];
vector<pair<long long, long long> > qq[300005];
void upd(long long x, long long y) {
  for (; x < 300005; x += (x & -x)) {
    BIT[x] += y;
  }
}
long long query(long long x) {
  long long ret = 0;
  for (; x > 0; x -= (x & -x)) {
    ret += BIT[x];
  }
  return ret;
}
void dfs(long long root, long long pa, long long de) {
  for (auto i : qq[root]) {
    long long x = i.first, y = i.second;
    upd(de, y);
    upd(de + x + 1, -y);
  }
  ans[root] = query(de);
  for (long long i : v[root]) {
    if (i != pa) {
      dfs(i, root, de + 1);
    }
  }
  for (auto i : qq[root]) {
    long long x = i.first, y = i.second;
    upd(de, -y);
    upd(de + x + 1, y);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long q;
  cin >> q;
  for (long long i = 1; i <= q; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    qq[x].push_back({y, z});
  }
  dfs(1, 0, 1);
  for (long long i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
