#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > vec(300009);
vector<long long> traversal;
long long visited[300009], intime[300009], outtime[300009],
    cnt = 0, level[300009], maxlevel = 0, levelans[300009], tree[4 * 300009];
void dfs(long long node) {
  cnt++;
  traversal.push_back(node);
  intime[node] = cnt;
  if (vec.size() == 1 && node != 1) {
    outtime[node] = cnt;
    return;
  }
  for (auto it = vec[node].begin(); it != vec[node].end(); it++) {
    if (visited[*it] == 0) {
      visited[*it] = 1;
      level[*it] = level[node] + 1;
      maxlevel = max(maxlevel, level[*it]);
      dfs(*it);
    }
  }
  outtime[node] = cnt;
}
void update(long long st, long long en, long long idx, long long node,
            long long val) {
  if (st == en) {
    tree[node] += val;
    return;
  }
  long long mid = (st + en) / 2;
  if (idx <= mid) {
    update(st, mid, idx, 2 * node, val);
  } else if (idx > mid) {
    update(mid + 1, en, idx, 2 * node + 1, val);
  }
  tree[node] = tree[2 * node] + tree[2 * node + 1];
}
long long query(long long st, long long en, long long l, long long r,
                long long node) {
  if (st >= l && en <= r) return tree[node];
  if (en < l || st > r) return 0;
  long long mid = (st + en) / 2;
  long long p = query(st, mid, l, r, 2 * node);
  long long p1 = query(mid + 1, en, l, r, 2 * node + 1);
  return p + p1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j;
  cin >> n;
  for (i = 1; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  traversal.push_back(0);
  level[1] = 1;
  maxlevel = max(maxlevel, level[1]);
  visited[1] = 1;
  dfs(1);
  long long m;
  cin >> m;
  vector<vector<pair<long long, long long> > > rage(300009);
  while (m--) {
    long long vi, di, xi;
    cin >> vi >> di >> xi;
    rage[intime[vi]].push_back(make_pair(xi, level[vi] + di));
    rage[outtime[vi] + 1].push_back(make_pair((-1 * xi), level[vi] + di));
  }
  for (i = 1; i < traversal.size(); i++) {
    for (auto it1 = rage[i].begin(); it1 != rage[i].end(); it1++) {
      update(1, 300008, (it1->second), 1, (it1->first));
    }
    levelans[traversal[i]] = query(1, 300008, level[traversal[i]], 300008, 1);
  }
  for (i = 1; i <= n; i++) cout << levelans[i] << " ";
}
