#include <bits/stdc++.h>
#pragma gcc optimize(O3)
using namespace std;
long long mod = 1e9 + 7;
double PI = 3.1415926535;
int inf = 1e9 + 7;
long long INF = 1e18 + 7;
long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }
long long pw(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 1) return a * pw(a, b - 1);
  if (b % 2 == 0) {
    long long c = pw(a, b / 2);
    return c * c;
  }
}
vector<vector<long long>> g;
vector<long long> qr, deep;
void dfs(long long v) {
  for (long long i = 0; i < g[v].size(); i++) {
    long long to = g[v][i];
    if (deep[to] == -1) {
      deep[to] = deep[v] + 1;
      dfs(to);
    }
  }
}
long long s;
struct stree {
  vector<long long> t;
  long long n;
  stree(vector<long long> a) {
    n = 1;
    while (n < a.size()) n *= 2;
    s = n;
    t.resize(n + n);
  }
  void summ(long long ql, long long qr, long long x, long long tl = 0,
            long long tr = s - 1, long long v = 1) {
    if (ql <= tl && tr <= qr)
      t[v] += x;
    else {
      long long mid = (tl + tr) / 2;
      if (ql <= mid) summ(ql, qr, x, tl, mid, v + v);
      if (qr > mid) summ(ql, qr, x, mid + 1, tr, v + v + 1);
    }
  }
  long long get(long long v) {
    long long ans = 0;
    v += n;
    while (v > 0) {
      ans += t[v];
      v /= 2;
    }
    return ans;
  }
};
stree d(vector<long long>(1e6));
vector<vector<pair<int, int>>> q_h;
vector<long long> val;
void dfs2(int v) {
  for (int i = 0; i < q_h[v].size(); i++) {
    int l = deep[v], r = q_h[v][i].second;
    d.summ(l, r, q_h[v][i].first);
  }
  val[v] = d.get(deep[v]);
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (val[to] == -1) dfs2(to);
  }
  for (int i = 0; i < q_h[v].size(); i++) {
    int l = deep[v], r = q_h[v][i].second;
    d.summ(l, r, -q_h[v][i].first);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  g.resize(n);
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  deep.resize(n, -1);
  deep[0] = 0;
  dfs(0);
  long long q;
  cin >> q;
  q_h.resize(n);
  for (long long i = 0; i < q; i++) {
    long long v, d, x;
    cin >> v >> d >> x;
    v--;
    d += deep[v];
    d = min(d, (long long)1e6 - 1);
    q_h[v].push_back(make_pair(x, d));
  }
  val.resize(n, -1);
  dfs2(0);
  for (int i = 0; i < n; i++) cout << val[i] << " ";
}
