#include <bits/stdc++.h>
const int N = 300100;
using namespace std;
int n, m;
int dep[N], MX;
vector<int> G[N];
vector<pair<int, long long> > A[N];
long long B[N], ans[N << 1];
void add(int x, long long v) {
  x += 10;
  for (int i = x; i; i -= (i & -i)) B[i] += v;
}
long long ask(int x) {
  long long ans = 0;
  x += 10;
  for (int i = x; i <= MX + 20; i += (i & (-i))) ans += B[i];
  return ans;
}
void dfs(int u, int fa) {
  dep[u] = dep[fa] + 1;
  MX = max(dep[u], MX);
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (v != fa) dfs(v, u);
  }
}
void dfs2(int u, int fa) {
  for (int i = 0; i < A[u].size(); ++i) add(A[u][i].first, A[u][i].second);
  ans[u] = ask(dep[u]);
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (v != fa) {
      dfs2(v, u);
    }
  }
  for (int i = 0; i < A[u].size(); ++i) add(A[u][i].first, -A[u][i].second);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dep[0] = -1;
  dfs(1, 0);
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    int v, d;
    long long x;
    scanf("%d%d%lld", &v, &d, &x);
    A[v].push_back(pair<int, long long>(min(dep[v] + d, MX), x));
  }
  dfs2(1, 0);
  for (int i = 1; i <= n; ++i) printf("%lld ", ans[i]);
  puts("");
  return 0;
}
