#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, long long int>>> Query;
vector<vector<int>> graph;
vector<long long int> keep(300005, 0), use, re;
int n, m;
void enter() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    vector<pair<int, long long int>> t;
    vector<int> t_;
    graph.push_back(t_);
    Query.push_back(t);
    re.push_back(0);
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    graph[u - 1].push_back(v - 1);
    graph[v - 1].push_back(u - 1);
  }
  cin >> m;
  while (m--) {
    long long int v, d, x;
    cin >> v >> d >> x;
    Query[v - 1].push_back(make_pair(d, x));
  }
}
void visit(int Ver, long long int Sum, int Father) {
  if (Ver == 0) {
    use.push_back(Ver);
    for (int i = 0; i < Query[Ver].size(); i++) {
      re[Ver] += Query[Ver][i].second;
      if (use.size() + Query[Ver][i].first < keep.size())
        keep[Query[Ver][i].first + use.size()] += Query[Ver][i].second;
    }
    for (int i = 0; i < graph[Ver].size(); i++)
      visit(graph[Ver][i], re[Ver], Ver);
  } else {
    use.push_back(Ver);
    re[Ver] = Sum;
    re[Ver] -= keep[use.size() - 1];
    for (int i = 0; i < Query[Ver].size(); i++) {
      re[Ver] += Query[Ver][i].second;
      Sum += Query[Ver][i].second;
      if (use.size() + Query[Ver][i].first < keep.size())
        keep[Query[Ver][i].first + use.size()] += Query[Ver][i].second;
    }
    for (int i = 0; i < graph[Ver].size(); i++) {
      if (graph[Ver][i] != Father) visit(graph[Ver][i], re[Ver], Ver);
    }
    for (int i = 0; i < Query[Ver].size(); i++) {
      if (use.size() + Query[Ver][i].first < keep.size())
        keep[Query[Ver][i].first + use.size()] -= Query[Ver][i].second;
    }
    use.pop_back();
  }
}
void Show() {
  for (int i = 0; i < re.size(); i++) cout << re[i] << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  enter();
  visit(0, 0, 0);
  Show();
  return 0;
}
