#include <bits/stdc++.h>
using namespace std;
template <class t>
t mag(t a) {
  return a > 0 ? a : -a;
}
template <class T, class U>
T cdiv(T num, U den) {
  return (num / den) + ((num % den) > 0);
}
std::ifstream term("/dev/tty");
std::string tempstring;
using ll = int_fast64_t;
using ii = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<ii>;
const int &sij = 400010;
const ll &mod = 1000000007ll;
int n, m;
ll vec[sij], pre[sij], dep[sij];
vi adj[sij];
vii qu[sij];
void add(int l, ll val) {
  while (l <= n) {
    pre[l] += val;
    l += l & -l;
  }
}
ll get(int ind) {
  ll ret = 0;
  while (ind) {
    ret += pre[ind];
    ind -= ind & -ind;
  }
  return ret;
}
void add(int l, int r, ll val) {
  add(l, val);
  add(r + 1, -val);
}
void dfs(int src, int par, int cdep) {
  for (auto &e : qu[src]) {
    add(cdep, cdep + e.first, e.second);
  }
  vec[src] = get(cdep);
  for (auto &e : adj[src])
    if (e != par) {
      dfs(e, src, cdep + 1);
    }
  for (auto &e : qu[src]) {
    add(cdep, cdep + e.first, -e.second);
  }
}
int esc(int tcase) {
  cin >> n;
  for (auto i = 1; i != n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  cin >> m;
  for (auto i = 1; i <= m; i++) {
    int d, val, v;
    cin >> v >> d >> val;
    qu[v].push_back({d, val});
  }
  dfs(1, 0, 1);
  for (auto i = 1; i <= n; i++) {
    cout << vec[i] << ' ';
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  for (int i = 1; i <= tc; i++) esc(i);
}
