#include <bits/stdc++.h>
using namespace std;
struct query {
  int v, d, x;
} qu[2000000];
long long n, m;
vector<int> gRaf[1999999];
vector<int> harcumner[1999999];
long long answer[1999999], xor_hel[1999999];
void dfs(int ski, int cno, int xo) {
  for (int i = 0; i < harcumner[ski].size(); i++) {
    xor_hel[xo] += qu[harcumner[ski][i]].x;
    xor_hel[xo + qu[harcumner[ski][i]].d + 1] -= qu[harcumner[ski][i]].x;
  }
  answer[ski] += answer[cno] + xor_hel[xo];
  for (int i = 0; i < gRaf[ski].size(); i++) {
    if (gRaf[ski][i] != cno) dfs(gRaf[ski][i], ski, xo + 1);
  }
  for (int i = 0; i < harcumner[ski].size(); i++) {
    xor_hel[xo] -= qu[harcumner[ski][i]].x;
    xor_hel[xo + qu[harcumner[ski][i]].d + 1] += qu[harcumner[ski][i]].x;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    gRaf[x].push_back(y);
    gRaf[y].push_back(x);
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> qu[i].v >> qu[i].d >> qu[i].x;
    qu[i].d = ((qu[i].d) < (n + 1)) ? (qu[i].d) : (n + 1);
    harcumner[qu[i].v].push_back(i);
  }
  dfs(1, 0, 0);
  for (int i = 1; i <= n; i++) printf("%lld%s", answer[i], " ");
  return 0;
}
