#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
struct segment_tree {
 private:
  long long sz;
  vector<long long> t;
  vector<long long> mod;
  void pull(long long v) { t[v] = t[2 * v + 1] + t[2 * v + 2]; }
  void update(long long v, long long l, long long r, long long val) {
    t[v] += val * (r - l);
    mod[v] += val;
  }
  void push(long long v, long long l, long long r) {
    if (mod[v] != 0) {
      long long m = (r + l) >> 1;
      update(2 * v + 1, l, m, mod[v]);
      update(2 * v + 2, m, r, mod[v]);
      mod[v] = 0;
    }
  }
  void build(long long v, long long l, long long r,
             const vector<long long> &b) {
    if (l + 1 == r) {
      t[v] = b[l];
    } else {
      long long m = (r + l) >> 1;
      build(2 * v + 1, l, m, b);
      build(2 * v + 2, m, r, b);
    }
  }
  long long get(long long v, long long l, long long r, long long pos) {
    if (l + 1 == r) {
      assert(l == pos);
      return t[v];
    } else {
      push(v, l, r);
      long long m = (r + l) >> 1;
      if (pos < m) {
        return get(2 * v + 1, l, m, pos);
      } else {
        return get(2 * v + 2, m, r, pos);
      }
    }
  }
  void add(long long v, long long l, long long r, long long ql, long long qr,
           long long val) {
    if (qr <= l || r <= ql) {
      return;
    } else if (ql <= l && r <= qr) {
      update(v, l, r, val);
    } else {
      push(v, l, r);
      long long m = (r + l) >> 1;
      add(2 * v + 1, l, m, ql, qr, val);
      add(2 * v + 2, m, r, ql, qr, val);
      pull(v);
    }
  }

 public:
  segment_tree() { sz = 0; }
  segment_tree(const vector<long long> &b) {
    sz = (long long)b.size();
    t.resize(4 * sz);
    mod.resize(4 * sz, 0);
    build(0, 0, sz, b);
  }
  void add(long long l, long long r, long long val) {
    add(0, 0, sz, l, r, val);
  }
  long long get(long long pos) { return get(0, 0, sz, pos); }
};
vector<vector<long long>> g;
vector<long long> used;
vector<vector<long long>> level;
vector<long long> h;
vector<long long> tin;
vector<long long> tout;
long long timer = 0;
void dfs(long long cur, long long lv) {
  h[cur] = lv;
  level[lv].push_back(cur);
  tin[cur] = timer;
  timer++;
  used[cur] = 1;
  for (auto t : g[cur]) {
    if (!used[t]) {
      dfs(t, lv + 1);
    }
  }
  tout[cur] = timer;
  timer++;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(16);
  long long n;
  cin >> n;
  h.resize(n);
  g.resize(n);
  used.resize(n);
  level.resize(n);
  tin.resize(n);
  tout.resize(n);
  for (long long i = 0; i + 1 < n; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(0, 0);
  long long q;
  cin >> q;
  vector<vector<tuple<long long, long long, long long, long long>>> bl(n);
  while (q--) {
    long long v, d, x;
    cin >> v >> d >> x;
    v--;
    bl[h[v]].push_back(make_tuple(0, tin[v], tout[v], x));
    bl[min(n - 1, h[v] + d)].push_back(make_tuple(1, tin[v], tout[v], x));
  }
  for (auto &t : bl) {
    sort(t.begin(), t.end());
  }
  vector<long long> ans(n);
  vector<long long> uupi(timer);
  segment_tree cur(uupi);
  for (long long i = 0; i < n; i++) {
    long long pnt = 0;
    while (pnt < (long long)bl[i].size() && !get<0>(bl[i][pnt])) {
      cur.add(get<1>(bl[i][pnt]), get<2>(bl[i][pnt]), get<3>(bl[i][pnt]));
      pnt++;
    }
    for (auto hh : level[i]) {
      ans[hh] = cur.get(tin[hh]);
    }
    while (pnt < (long long)bl[i].size() && get<0>(bl[i][pnt])) {
      cur.add(get<1>(bl[i][pnt]), get<2>(bl[i][pnt]), -get<3>(bl[i][pnt]));
      pnt++;
    }
  }
  for (auto t : ans) {
    cout << t << ' ';
  }
}
