#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
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> ask[N];
int dep[N];
int vis[N];
long long sum[N];
long long ans[N];
int lowbit(int x) { return (x & (-x)); }
void add(int x, int v) {
  for (int i = x; i <= n; i += lowbit(i)) {
    sum[i] += 1ll * v;
  }
}
long long getsum(int x) {
  long long ans = 0;
  for (int i = x; i > 0; i -= lowbit(i)) {
    ans += sum[i];
  }
  return ans;
}
void dfs(int u) {
  vis[u] = 1;
  for (int i = 0; i < ask[u].size(); i++) {
    int d = ask[u][i].d;
    int x = ask[u][i].x;
    add(dep[u], +x);
    if (dep[u] + d + 1 <= n) {
      add(dep[u] + d + 1, -x);
    }
  }
  ans[u] = getsum(dep[u]);
  for (auto &v : adj[u]) {
    if (vis[v]) {
      continue;
    }
    dep[v] = dep[u] + 1;
    dfs(v);
  }
  for (int i = 0; i < ask[u].size(); i++) {
    int d = ask[u][i].d;
    int x = ask[u][i].x;
    add(dep[u], -x);
    if (dep[u] + d + 1 <= n) {
      add(dep[u] + d + 1, x);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  cin >> q;
  while (q--) {
    int v, d, x;
    cin >> v >> d >> x;
    ask[v].push_back(node(d, x));
  }
  dep[1] = 1;
  dfs(1);
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
