#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
const long long inf = (long long)1e16;
const long double eps = 1e-12;
const long long N = (int)3e5 + 5;
const long long LOGN = 19;
const long double PI = 3.14159265358979323846;
inline long long mul(long long a, long long b, long long m = mod) {
  return (long long)(a * b) % m;
}
inline long long add(long long a, long long b, long long m = mod) {
  a += b;
  if (a >= m) a -= m;
  if (a < 0) a += m;
  return a;
}
inline long long power(long long a, long long b, long long m = mod) {
  if (b == 0) return 1;
  if (b == 1) return (a % m);
  long long x = power(a, b / 2, m);
  x = mul(x, x, m);
  if (b % 2) x = mul(x, a, m);
  return x;
}
int n, q;
long long ans[N];
vector<int> adj[N];
vector<pair<int, int> > queries[N];
struct node {
  long long val;
  long long lazy;
  node() {
    val = 0;
    lazy = 0;
  }
  inline void merge(node &l, node &r) { val = l.val + r.val; }
  inline void no_use() {
    val = 0;
    lazy = 0;
  }
};
node segtree[N << 2];
void propogate(int num, int start, int end, long long mul) {
  segtree[num].val += (end - start + 1) * mul * 1ll;
  if (start != end) {
    segtree[num + num + 1].lazy += mul;
    segtree[num + num + 2].lazy += mul;
  }
}
void update(int num, int start, int end, int l, int r, long long p) {
  if (segtree[num].lazy != 0) {
    propogate(num, start, end, segtree[num].lazy);
    segtree[num].lazy = 0;
  }
  if (start > end || start > r || end < l) return;
  if (start >= l && end <= r) {
    propogate(num, start, end, p);
    return;
  }
  int lc = num + num + 1, rc = lc + 1;
  int mid = (start + end) >> 1;
  update(lc, start, mid, l, r, p);
  update(rc, mid + 1, end, l, r, p);
  segtree[num].merge(segtree[lc], segtree[rc]);
}
node query(int num, int start, int end, int qs, int qe) {
  if (start > qe || end < qs) {
    node ret;
    ret.no_use();
    return ret;
  }
  if (segtree[num].lazy != 0) {
    propogate(num, start, end, segtree[num].lazy);
    segtree[num].lazy = 0;
  }
  if (start >= qs && end <= qe) {
    return segtree[num];
  }
  int lc = num + num + 1, rc = lc + 1;
  int mid = (start + end) >> 1;
  node lf = query(lc, start, mid, qs, qe);
  node rg = query(rc, mid + 1, end, qs, qe);
  node ret;
  ret.merge(lf, rg);
  return ret;
}
void dfs(int src, int par, int dep) {
  for (auto &it : queries[src]) {
    int upto = min(it.first + dep, (int)N - 1);
    update(0, 0, N - 1, dep, upto, it.second);
  }
  ans[src] = query(0, 0, N - 1, dep, dep).val;
  for (int u : adj[src]) {
    if (u == par) continue;
    dfs(u, src, dep + 1);
  }
  for (auto &it : queries[src]) {
    int upto = min(it.first + dep, (int)N - 1);
    update(0, 0, N - 1, dep, upto, -it.second);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  if (0) {
    freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r",
            stdin);
    freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w",
            stdout);
  }
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  cin >> q;
  for (int i = 0; i < q; i++) {
    int v, d, x;
    cin >> v >> d >> x;
    d = min(d, n);
    queries[v].push_back({d, x});
  }
  dfs(1, 1, 1);
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
