#include <bits/stdc++.h>
using namespace ::std;
const int N = (int)3e5 + 5, z = 512 * 1024;
vector<int> t[N];
vector<pair<int, int>> q[N];
int n, m;
long long rez[N], d[2 * z];
void dodaj(int v, int x) {
  v += z;
  while (v) {
    d[v] += x;
    v /= 2;
  }
}
long long odczyt(int a, int b) {
  long long wyn = 0;
  a += z - 1, b += z + 1;
  while (a != b - 1) {
    if (a % 2 == 0) wyn += d[a + 1];
    if (b % 2 == 1) wyn += d[b - 1];
    a /= 2, b /= 2;
  }
  return wyn;
}
void dfs(int v, int p, int gl) {
  for (auto it : q[v]) dodaj(min(N, gl + it.first), it.second);
  rez[v] += odczyt(gl, N);
  for (int w : t[v])
    if (w != p) dfs(w, v, gl + 1);
  for (auto it : q[v]) dodaj(min(N, gl + it.first), -it.second);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    t[a].push_back(b);
    t[b].push_back(a);
  }
  scanf("%d", &m);
  while (m) {
    int v, d, x;
    scanf("%d%d%d", &v, &d, &x);
    q[v].push_back({d, x});
    m--;
  }
  dfs(1, 0, 0);
  for (int i = 1; i <= n; i++) printf("%lld ", rez[i]);
}
