#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 100;
vector<int> adj[maxn], seg[4 * maxn];
vector<long long int> SEG[4 * maxn];
int n, Tim, st[maxn], fi[maxn], arr[maxn], h[maxn];
long long int cost[maxn];
void dfs(int v, int par = -1) {
  st[v] = Tim++;
  for (auto u : adj[v])
    if (u != par) {
      h[u] = h[v] + 1;
      dfs(u, v);
    }
  fi[v] = Tim;
}
bool cmp(int v, int u) { return (h[v] < h[u]); }
void build(int first = 0, int second = n, int id = 1) {
  if (first == second - 1) {
    seg[id].push_back(arr[first]);
    SEG[id].push_back(0);
    return;
  }
  int mid = (first + second) >> 1;
  build(first, mid, id * 2 + 0);
  build(mid, second, id * 2 + 1);
  for (int i = 0; i < seg[id * 2 + 0].size(); i++)
    seg[id].push_back(seg[id * 2 + 0][i]);
  for (int i = 0; i < seg[id * 2 + 1].size(); i++)
    seg[id].push_back(seg[id * 2 + 1][i]);
  for (int i = 0; i < seg[id].size(); i++) SEG[id].push_back(0);
  sort(seg[id].begin(), seg[id].end(), cmp);
}
void add(int l, int r, int lim, int val, int first = 0, int second = n,
         int id = 1) {
  if (l == first && r == second) {
    int lo = 0, hi = second - first;
    while (hi - lo > 1) {
      int mid = (lo + hi) >> 1;
      if (h[seg[id][mid]] <= lim)
        lo = mid;
      else
        hi = mid;
    }
    if (h[seg[id][0]] > lim) return;
    SEG[id][0] += val;
    if (hi != second - first) SEG[id][hi] -= val;
    return;
  }
  int mid = (first + second) >> 1;
  if (l < mid) add(l, min(mid, r), lim, val, first, mid, id * 2 + 0);
  if (mid < r) add(max(l, mid), r, lim, val, mid, second, id * 2 + 1);
}
void sum_build(int first = 0, int second = n, int id = 1) {
  if (first == second - 1) {
    cost[seg[id][0]] += SEG[id][0];
    return;
  }
  int mid = (first + second) >> 1;
  sum_build(first, mid, id * 2 + 0);
  sum_build(mid, second, id * 2 + 1);
  for (int i = 0; i < SEG[id].size(); i++) {
    if (i > 0) SEG[id][i] += SEG[id][i - 1];
    cost[seg[id][i]] += SEG[id][i];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int v, u;
    cin >> v >> u;
    v--, u--;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  dfs(0);
  for (int v = 0; v < n; v++) arr[st[v]] = v;
  build();
  int m;
  cin >> m;
  while (m--) {
    int v, d, x;
    cin >> v >> d >> x;
    v--;
    add(st[v], fi[v], h[v] + d, x);
  }
  sum_build();
  for (int i = 0; i < n; i++) cout << cost[i] << ' ';
  cout << endl;
  return 0;
}
