#include <bits/stdc++.h>
using namespace std;
const int MX = 300009, MXL = 20;
vector<int> v[MX];
int n, depth[MX], par[MXL][MX];
vector<int> ord;
int in[MX], out[MX];
int c = 1;
void Pdfs(int x, int p) {
  int nxt, sz = v[x].size();
  in[x] = c++;
  ord.push_back(x);
  for (int j = 0; j < sz; j++) {
    nxt = v[x][j];
    if (nxt == p) continue;
    depth[nxt] = depth[x] + 1;
    par[0][nxt] = x;
    Pdfs(nxt, x);
  }
  out[x] = c - 1;
}
void process() {
  for (int j = 1; j < MXL; j++)
    for (int i = 1; i <= n; i++) par[j][i] = par[j - 1][par[j - 1][i]];
}
int Kth(int x, int K) {
  int node = x;
  for (int j = 0; j < MXL; j++)
    if ((K & (1 << j))) node = par[j][node];
  return node;
}
int LCA(int a, int b) {
  if (a == b) return a;
  if (depth[a] > depth[b]) swap(a, b);
  b = Kth(b, depth[b] - depth[a]);
  if (a == b) return b;
  for (int j = MXL - 1; j >= 0; j--)
    if (par[j][a] != par[j][b]) a = par[j][a], b = par[j][b];
  return par[0][a];
}
long long int amid[MX], sm[MX];
vector<pair<int, pair<long long int, long long int> > > qq;
void solve(int node, int p, int d, int idx, long long int m) {
  amid[ord[c]] -= m;
  c++;
  int sz = v[node].size();
  if (sz == 1 && node != 1) return;
  while (idx != qq.size() && d == qq[idx].first) {
    int a = node, b = qq[idx].second.first, c = LCA(a, b);
    if (c == b) m += qq[idx].second.second;
    idx++;
  }
  for (int i = 0; i < sz; i++) {
    int nx = v[node][i];
    if (nx == p) continue;
    solve(nx, node, d + 1, idx, m);
  }
}
int main() {
  ord.push_back(-1);
  depth[1] = 1;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  Pdfs(1, -1);
  process();
  int q;
  cin >> q;
  while (q--) {
    int vv, d, x;
    scanf("%d%d%d", &vv, &d, &x);
    qq.push_back({depth[vv] + d, {vv, x}});
    sm[in[vv]] += x;
    sm[out[vv] + 1] -= x;
  }
  long long int cur = 0;
  sort(qq.begin(), qq.end());
  for (int i = 1; i <= n; i++) {
    cur += sm[i];
    sm[i] = cur;
    amid[ord[i]] = cur;
  }
  c = 1;
  solve(1, 1, 1, 0, 0);
  for (int i = 1; i <= n; i++) printf("%lld ", amid[i]);
}
