#include <bits/stdc++.h>
using namespace std;
vector<int> g[300011];
long long ans[300011];
struct P {
  long long dis = -1, val = 0;
} temp;
vector<P> m[300011];
map<long long, long long> bit;
void add(long long i, long long val) {
  i = 1000000000000000 - i;
  for (; i < 1000000000000000; i += (i & (-i))) bit[i] += val;
}
long long get(long long i) {
  long long ret = 0;
  i = 1000000000000000 - i;
  for (; i > 0; i -= (i & (-i))) ret += bit[i];
  return ret;
}
void dfs(int u, int par = 0, long long lev = 1) {
  for (auto i : m[u]) add(lev + i.dis, i.val);
  ans[u] = get(lev);
  for (auto v : g[u]) {
    if (v != par) dfs(v, u, lev + 1);
  }
  for (auto i : m[u]) add(lev + i.dis, -i.val);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, x, y, v, d;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int q;
  cin >> q;
  while (q--) {
    cin >> v >> d >> x;
    temp.dis = d;
    temp.val = x;
    m[v].push_back(temp);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
