#include <bits/stdc++.h>
using namespace std;
const int MAX = 300010;
map<pair<int, int>, long long> M;
int L[MAX], st[MAX], en[MAX];
long long val[MAX], res[MAX];
vector<int> ed[MAX];
vector<pair<int, int> > lst[MAX];
int T = 0;
int maxL = 0;
void dfs(int s, int p) {
  T++;
  st[s] = T;
  for (auto x : ed[s]) {
    if (x != p) {
      L[x] = L[s] + 1;
      dfs(x, s);
      lst[L[x]].push_back({st[x], x});
      maxL = max(maxL, L[x]);
    }
  }
  T++;
  en[s] = T;
}
int getFirst(int lev, int threshold) {
  int mid, low = 0, high = (int)lst[lev].size() - 1, ret = lst[lev].size();
  while (low <= high) {
    mid = (low + high) / 2;
    if (lst[lev][mid].first >= threshold) {
      high = mid - 1;
      ret = mid;
    } else
      low = mid + 1;
  }
  return ret;
}
void calc(int s, int p, long long carry) {
  res[s] = carry + val[s];
  for (auto x : ed[s]) {
    if (x == p) continue;
    calc(x, s, carry + val[s]);
  }
}
int main() {
  int n, u, v;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    ed[u].push_back(v);
    ed[v].push_back(u);
  }
  int d, q;
  long long x;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d %d", &v, &d);
    scanf("%lld", &x);
    M[make_pair(v, d)] += x;
  }
  lst[0].push_back({1, 1});
  dfs(1, -1);
  for (auto e : M) {
    val[e.first.first] += e.second;
    int lev = L[e.first.first] + e.first.second + 1;
    if (lev > maxL) continue;
    int pos = getFirst(lev, st[e.first.first]);
    for (int i = pos; i < lst[lev].size(); i++) {
      if (en[lst[lev][i].second] >= st[e.first.first] and
          en[lst[lev][i].second] <= en[e.first.first]) {
        val[lst[lev][i].second] -= e.second;
      } else
        break;
    }
  }
  calc(1, -1, 0);
  for (int i = 1; i <= n; i++) {
    cout << res[i] << " ";
  }
  puts("");
  return 0;
}
