#include <bits/stdc++.h>
using namespace std;
const int maxN = 3e5 + 11;
typedef int i_N[maxN];
int N, Q, Cnum;
long long IT[maxN * 4], ans[maxN];
vector<int> adj[maxN], node[maxN];
i_N P, L, num, hi;
vector<pair<int, pair<int, int> > > in[maxN * 2], out[maxN * 2];
void update(int k, int l, int r, int i, int j, int v) {
  if (j < l || i > r) return;
  if (i <= l && j >= r) {
    IT[k] += v;
    return;
  }
  int mid = (l + r) / 2;
  update(k * 2, l, mid, i, j, v);
  update(k * 2 + 1, mid + 1, r, i, j, v);
}
long long get_IT(int k, int l, int r, int i) {
  if (i < l || i > r) return 0;
  long long res = IT[k];
  if (l == r) return res;
  int mid = (l + r) / 2;
  return res + get_IT(k * 2, l, mid, i) + get_IT(k * 2 + 1, mid + 1, r, i);
}
void dfs(int u) {
  num[u] = ++Cnum;
  for (auto v : adj[u]) {
    if (P[v]) continue;
    P[v] = u;
    L[v] = L[u] + 1;
    dfs(v);
  }
  hi[u] = Cnum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  for (int i = 1; i <= N - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  P[1] = -1;
  dfs(1);
  cin >> Q;
  for (int i = 1; i <= Q; i++) {
    int u, d, x;
    cin >> u >> d >> x;
    d = min(d, N);
    in[L[u]].push_back(
        pair<int, pair<int, int> >(x, pair<int, int>(num[u], hi[u])));
    out[L[u] + d].push_back(
        pair<int, pair<int, int> >(x, pair<int, int>(num[u], hi[u])));
  }
  for (int i = 1; i <= N; i++) node[L[i]].push_back(i);
  for (int i = 0; i < N; i++) {
    if (i > 0) {
      for (auto W : out[i - 1]) {
        int x = W.first, l = W.second.first, r = W.second.second;
        update(1, 1, N, l, r, -x);
      }
    }
    for (auto W : in[i]) {
      int x = W.first, l = W.second.first, r = W.second.second;
      update(1, 1, N, l, r, x);
    }
    for (auto u : node[i]) {
      ans[u] = get_IT(1, 1, N, num[u]);
    }
  }
  for (int i = 1; i <= N; i++) cout << ans[i] << ' ';
}
