#include <bits/stdc++.h>
using namespace std;
struct Vertex {
  long long num;
  vector<int> childs;
  std::map<int, long> add;
  long long sumAdd;
  Vertex() {
    num = 0;
    sumAdd = 0;
  }
};
Vertex v[300005];
long long buffer[300005] = {0};
long n, m;
void rec(long idx, long level, long long toAdd, long pred) {
  toAdd += v[idx].sumAdd;
  v[idx].num += toAdd;
  for (auto it = v[idx].add.begin(); it != v[idx].add.end(); ++it)
    if (level + it->first <= n) buffer[level + it->first] += it->second;
  toAdd -= buffer[level];
  for (int i = 0; i < v[idx].childs.size(); i++)
    if (v[idx].childs[i] != pred) rec(v[idx].childs[i], level + 1, toAdd, idx);
  for (auto it = v[idx].add.begin(); it != v[idx].add.end(); ++it)
    if (level + it->first <= n) buffer[level + it->first] -= it->second;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    long x, y;
    cin >> x >> y;
    v[x].childs.push_back(y);
    v[y].childs.push_back(x);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    long vv, d, x;
    cin >> vv >> d >> x;
    auto it = v[vv].add.find(d);
    if (it == v[vv].add.end())
      v[vv].add.insert(make_pair(d, x));
    else
      it->second += x;
    v[vv].sumAdd += x;
  }
  rec(1, 1, 0, 0);
  for (int i = 1; i <= n; i++) {
    cout << v[i].num << " ";
  }
  return 0;
}
