#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > q[300005];
vector<int> tree[300005];
long long BIT[300005];
long long ans[300005];
int n, m;
void update(int x, int v) {
  while (x <= 300005) {
    BIT[x] += v;
    x = x + (x & (-x));
  }
}
long long get_sum(int x) {
  long long second = 0;
  while (x > 0) {
    second = second + BIT[x];
    x = x - (x & (-x));
  }
  return second;
}
void DFS(int i, int p, int depth) {
  for (int j = 0; j < q[i].size(); j++) {
    update(depth, q[i][j].second);
    update(depth + q[i][j].first + 1, (-1) * q[i][j].second);
  }
  ans[i] = get_sum(depth);
  for (int j = 0; j < tree[i].size(); j++) {
    if (tree[i][j] != p) {
      DFS(tree[i][j], i, depth + 1);
    }
  }
  for (int j = 0; j < q[i].size(); j++) {
    update(depth, (-1) * q[i][j].second);
    update(depth + q[i][j].first + 1, q[i][j].second);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    tree[u].push_back(v);
    tree[v].push_back(u);
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    int u, d, x;
    cin >> u >> d >> x;
    q[u].push_back(make_pair(d, x));
  }
  DFS(1, 0, 1);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
