#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
vector<int> g[3 * 100500];
int d[300500];
int tin[300500];
int tout[300500];
int timer;
void init(int v, int p = -1) {
  tin[v] = ++timer;
  for (auto to : g[v]) {
    if (to != p) {
      d[to] = d[v] + 1;
      init(to, v);
    }
  }
  tout[v] = ++timer;
}
long long t[600500];
long long get(int r) {
  long long res = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) res += t[r];
  return res;
}
long long get(int l, int r) { return get(r) - get(l - 1); }
void upd(int l, long long d) {
  for (; l <= 6e5; l = (l | (l + 1))) t[l] += d;
}
long long a[300500];
vector<pair<int, long long>> e[300500];
vector<pair<int, long long>> re[300500];
bool used[300500];
void bfs() {
  queue<int> q;
  q.push(1);
  int age = -1;
  while (!q.empty()) {
    int v = q.front();
    used[v] = 1;
    q.pop();
    if (age != d[v]) {
      for (auto i : re[d[v]]) {
        upd(tin[i.first], -i.second);
        upd(tout[i.first], i.second);
      }
      for (auto i : e[d[v]]) {
        upd(tin[i.first], i.second);
        upd(tout[i.first], -i.second);
      }
      age = d[v];
    }
    a[v] = get(tin[v]);
    for (auto to : g[v]) {
      if (!used[to]) {
        q.push(to);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int v, u;
    cin >> v >> u;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  init(1);
  int q;
  cin >> q;
  for (int i = 1; i <= q; ++i) {
    int v, k;
    long long x;
    cin >> v >> k >> x;
    e[d[v]].push_back({v, x});
    re[min(d[v] + k + 1, (int)3e5)].push_back({v, x});
  }
  bfs();
  for (int i = 1; i <= n; ++i) {
    cout << a[i] << ' ';
  }
  return 0;
}
