#include <bits/stdc++.h>
using namespace std;
const long long int siz = 3e5 + 5;
map<int, vector<int>> adjList;
long long int ans[siz] = {0};
long long int cum[siz] = {0};
map<long long int, long long int> q[siz];
void dfs(int cur, int parent, int level, long long int val) {
  for (pair<long long int, long long int> temp : q[cur]) {
    cum[level] += temp.second;
    cum[min(level + temp.first + 1, siz - 1)] -= temp.second;
  }
  val += cum[level];
  ans[cur] = val;
  for (int child : adjList[cur]) {
    if (child != parent) {
      dfs(child, cur, level + 1, val);
    }
  }
  for (pair<long long int, long long int> temp : q[cur]) {
    cum[level] -= temp.second;
    cum[min(level + temp.first + 1, siz - 1)] += temp.second;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  int y;
  long long int x;
  for (int i = 0; i < (int)(n - 1); i++) {
    cin >> x >> y;
    adjList[x].push_back(y);
    adjList[y].push_back(x);
  }
  int m;
  cin >> m;
  int d, v;
  for (int i = 0; i < (int)(m); i++) {
    cin >> v >> d >> x;
    q[v][d] += x;
  }
  dfs(1, -1, 1, 0);
  for (int i = 1; i <= (int)(n); i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
