#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
int n, Q;
vector<int> adj[N];
struct node {
  int d, x;
  node(int d = 0, int x = 0) : d(d), x(x) {}
};
vector<node> q[N];
long long ans[N];
long long fw[N];
inline int lowbit(int x) { return x & (-x); }
inline void change(int x, int v) {
  for (; x <= n; x += lowbit(x)) fw[x] += v;
}
inline long long query(int x) {
  long long res = 0;
  for (; x; x -= lowbit(x)) res += fw[x];
  return res;
}
void dfs(int u, int fa, int dep) {
  int v, d, x;
  for (int i = 0; i < q[u].size(); i++) {
    d = q[u][i].d;
    x = q[u][i].x;
    change(dep, +x);
    if (dep + d + 1 <= n) change(dep + d + 1, -x);
  }
  ans[u] = query(dep);
  for (int i = 0; i < adj[u].size(); i++) {
    v = adj[u][i];
    if (v == fa) continue;
    dfs(v, u, dep + 1);
  }
  for (int i = 0; i < q[u].size(); i++) {
    d = q[u][i].d;
    x = q[u][i].x;
    change(dep, -x);
    if (dep + d + 1 <= n) change(dep + d + 1, +x);
  }
}
int main() {
  n = read();
  int u, v, d, x;
  for (int i = 2; i <= n; i++) {
    u = read();
    v = read();
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  Q = read();
  while (Q--) {
    v = read();
    d = read();
    x = read();
    q[v].push_back(node(d, x));
  }
  dfs(1, 0, 1);
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
  puts("");
  return 0;
}
