#include <bits/stdc++.h>
using namespace std;
template <class T>
struct BIT {
  T *bit;
  int n;
  BIT(int n) : n(n) { bit = (T *)calloc(n + 1, sizeof(T)); }
  ~BIT() { free(bit); }
  void reset() { memset(bit, 0, sizeof(T) * (n + 1)); }
  void update(int u, T v) {
    while (u <= n) bit[u] += v, u += (u & -u);
  }
  T read(int u) {
    T ret = 0;
    while (u) ret += bit[u], u -= (u & -u);
    return ret;
  }
};
const int MAXN = 300005;
vector<int> order;
int pos = -1;
int st[MAXN], en[MAXN];
int dep[MAXN];
vector<int> g[MAXN];
long long final_weight[MAXN];
vector<pair<pair<int, int>, int> > events[MAXN];
BIT<long long> bit(MAXN);
int brute_weight[MAXN];
void rangeUpdate(int l, int r, int v) {
  bit.update(l + 1, v);
  bit.update(r + 2, -v);
}
long long pointQuery(int l) { return bit.read(l + 1); }
void dfs(int u, int p = 0) {
  st[u] = ++pos;
  dep[u] = dep[p] + 1;
  order.push_back(u);
  for (auto v : g[u]) {
    if (v != p) {
      dfs(v, u);
    }
  }
  en[u] = pos;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1);
  int m;
  cin >> m;
  while (m--) {
    int v, d, x;
    cin >> v >> d >> x;
    events[st[v]].push_back({{dep[v], dep[v] + d}, x});
    events[en[v] + 1].push_back({{dep[v], dep[v] + d}, -x});
  }
  for (int i = 0; i < n; ++i) {
    for (auto e : events[i]) {
      rangeUpdate(e.first.first, e.first.second, e.second);
    }
    final_weight[order[i]] = pointQuery(dep[order[i]]);
  }
  for (int i = 1; i <= n; ++i) {
    cout << final_weight[i] << " ";
  }
}
