#include <bits/stdc++.h>
using namespace std;
long long int z = 1000000007;
long long int inf = 1e9;
long long int LIM = 4e5 + 3;
vector<vector<long long int> > adj(LIM);
vector<long long int> level(LIM, -1);
vector<long long int> add(LIM, 0);
vector<long long int> ans(LIM, 0);
vector<vector<pair<long long int, long long int> > > query(LIM);
void dfs(int n, vector<long long int> &visited, int depth) {
  for (int i = 0; i < adj[n].size(); i++) {
    if (visited[adj[n][i]] == -1) {
      visited[adj[n][i]] = 1;
      level[adj[n][i]] = depth;
      dfs(adj[n][i], visited, depth + 1);
    }
  }
}
void dfs2(int n, vector<long long int> &visited, long long int sum, int depth) {
  for (int i = 0; i < query[n].size(); i++) {
    add[depth] += query[n][i].second;
    add[depth + query[n][i].first + 1] -= query[n][i].second;
  }
  sum = sum + add[depth];
  ans[n] = ans[n] + sum;
  for (int i = 0; i < adj[n].size(); i++) {
    if (visited[adj[n][i]] == -1) {
      visited[adj[n][i]] = 1;
      dfs2(adj[n][i], visited, sum, depth + 1);
    }
  }
  for (int i = 0; i < query[n].size(); i++) {
    add[depth] -= query[n][i].second;
    add[depth + query[n][i].first + 1] += query[n][i].second;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  level[1] = 1;
  vector<long long int> visited(LIM + 1, -1);
  visited[1] = 1;
  dfs(1, visited, 2);
  int m;
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int vi, d, x;
    cin >> vi >> d >> x;
    query[vi].push_back(pair<long long int, long long int>(min(d, 300000), x));
  }
  vector<long long int> visited2(LIM, -1);
  visited2[1] = 1;
  dfs2(1, visited2, add[1], 1);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
