#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long exp(long long x, long long y) {
  x %= 1000000007;
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    y >>= 1;
  }
  return res;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 2; i <= n; i = i + 1) (res *= i) %= 1000000007;
  return res;
}
bool isprime(long long n) {
  if (n <= 1) return 0;
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) return 0;
  return 1;
}
const long long N = 3e5 + 5;
vector<long long> g[N], f(N), bit(N);
vector<array<long long, 2>> q[N];
void update(int idx, long long del) {
  for (; idx < N; idx = idx | (1 + idx)) bit[idx] += del;
}
long long get(int idx) {
  long long res = 0;
  for (; idx >= 0; idx = (idx & (1 + idx)) - 1) res += bit[idx];
  return res;
}
void dfs(int s, int par = 0, int d = 0) {
  for (auto i : q[s]) {
    update(min(N - 1, d + i[0]), i[1]);
  }
  f[s] = get(N - 1) - get(d - 1);
  for (auto to : g[s]) {
    if (to != par) dfs(to, s, d + 1);
  }
  for (auto i : q[s]) {
    update(min(N - 1, d + i[0]), -i[1]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    long long v, d, x;
    cin >> v >> d >> x;
    q[v].push_back({d, x});
  }
  dfs(1);
  for (int i = 1; i <= n; ++i) cout << f[i] << " ";
  return 0;
}
