#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5 + 5;
const int M = 1e6;
const long long INF = (long long)(1e18);
const int inf = 2e9;
const long long MOD = 1000000007LL;
int n, Q;
long long a[MAX_N];
int depth[MAX_N];
int maxDepth = 0;
vector<int> G[MAX_N];
map<int, long long> mp[MAX_N];
map<int, long long> stop;
void dfs1(int v, int p) {
  if (p == -1) {
    depth[v] = 1;
  } else {
    depth[v] = depth[p] + 1;
  }
  maxDepth = max(maxDepth, depth[v]);
  for (int to : G[v]) {
    if (to == p) continue;
    dfs1(to, v);
  }
}
void dfs2(int v, int p) {
  int me = depth[v];
  if (p != -1) a[v] += a[p];
  a[v] += stop[me];
  for (auto it : mp[v]) {
    int who = it.first;
    stop[who] += it.second;
  }
  for (int to : G[v]) {
    if (to == p) continue;
    dfs2(to, v);
  }
  for (auto it : mp[v]) {
    int who = it.first;
    stop[who] -= it.second;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs1(1, -1);
  cin >> Q;
  for (int q = 0; q < Q; q++) {
    int v, d;
    long long x;
    cin >> v >> d >> x;
    a[v] += x;
    int base = depth[v];
    int toRem = base + d + 1;
    if (toRem > maxDepth) continue;
    mp[v][toRem] -= x;
  }
  dfs2(1, -1);
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
