#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 100;
const int sq = 100;
const long long int mod = 1e9 + 7;
const long long int inf = 1e9;
long long int seg[4 * N], ans[N];
int h[N], par[N], n;
vector<int> adj[N];
vector<pair<int, int>> qu[N];
long long int get(int l, int r, int b = 0, int e = 2 * n, int ind = 1) {
  if (e <= l || r <= b) return 0;
  if (l <= b && e <= r) return seg[ind];
  int mid = (b + e) / 2;
  return get(l, r, b, mid, ind * 2) + get(l, r, mid, e, ind * 2 + 1);
}
void add(int x, long long int val, int b = 0, int e = 2 * n, int ind = 1) {
  if (b + 1 == e) {
    seg[ind] += val;
    return;
  }
  int mid = (b + e) / 2;
  if (x < mid)
    add(x, val, b, mid, ind * 2);
  else
    add(x, val, mid, e, ind * 2 + 1);
  seg[ind] = seg[ind * 2] + seg[ind * 2 + 1];
}
void dfs(int u) {
  for (auto it : qu[u]) {
    int d = it.first, c = it.second;
    add(h[u] + d, c);
  }
  ans[u] = get(h[u], 2 * n);
  for (auto x : adj[u]) {
    if (x != par[u]) {
      par[x] = u;
      h[x] = h[u] + 1;
      dfs(x);
    }
  }
  for (auto it : qu[u]) {
    int d = it.first, c = it.second;
    add(h[u] + d, -c);
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(0);
  int q;
  cin >> q;
  while (q--) {
    int u, d, x;
    cin >> u >> d >> x;
    u--;
    d = min(d, n);
    qu[u].push_back({d, x});
  }
  dfs(0);
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
