#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
template <typename first, typename second>
ostream& operator<<(ostream& os, const pair<first, second>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "]";
}
template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}
template <typename first, typename second>
ostream& operator<<(ostream& os, const map<first, second>& v) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << ", ";
    os << it->first << " = " << it->second;
  }
  return os << "]";
}
void faltu() { cerr << '\n'; }
template <typename T>
void faltu(T a[], int n) {
  for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
  cerr << '\n';
}
template <typename T, typename... hello>
void faltu(T arg, const hello&... rest) {
  cerr << arg << ' ';
  faltu(rest...);
}
const int mx = 3e5 + 5;
int n;
vector<int> adjlist[mx];
long long dist[mx];
int pre[mx];
int sub[mx];
int nxt = 1;
vector<pair<int, int> > vec1[mx];
vector<long long> vec2[mx];
int ul;
int lvl[mx];
void dfs1(int u, int par) {
  pre[u] = nxt++;
  sub[u] = 1;
  for (auto v : adjlist[u]) {
    if (v == par) continue;
    dfs1(v, u);
    sub[u] += sub[v];
  }
}
void dfs2(int u, int par, int dis) {
  lvl[u] = dis;
  ul = max(ul, dis);
  vec1[dis].push_back(make_pair(pre[u], u));
  vec2[dis].push_back(0);
  for (auto v : adjlist[u]) {
    if (v == par) continue;
    dfs2(v, u, dis + 1);
  }
}
void dfs3(int u, int par) {
  dist[u] += dist[par];
  for (auto v : adjlist[u]) {
    if (v == par) continue;
    dfs3(v, u);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    adjlist[u].push_back(v);
    adjlist[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0, 0);
  int m;
  cin >> m;
  while (m--) {
    int v, d, x;
    cin >> v >> d >> x;
    d += lvl[v] + 1;
    dist[v] += x;
    int l = pre[v], r = pre[v] + sub[v] - 1;
    if (d > ul) continue;
    int idx1 = lower_bound(vec1[d].begin(), vec1[d].end(), make_pair(l, -1)) -
               vec1[d].begin();
    int idx2 = lower_bound(vec1[d].begin(), vec1[d].end(), make_pair(r, inf)) -
               vec1[d].begin();
    if (idx1 < (int)vec1[d].size()) vec2[d][idx1] += x;
    if (idx2 < (int)vec1[d].size()) vec2[d][idx2] -= x;
  }
  for (int i = 0; i <= ul; ++i) {
    for (int j = 1; j < (int)vec2[i].size(); ++j) {
      vec2[i][j] += vec2[i][j - 1];
    }
    for (int j = 0; j < (int)vec2[i].size(); ++j) {
      dist[vec1[i][j].second] -= vec2[i][j];
    }
  }
  dfs3(1, 0);
  for (int i = 1; i <= n; ++i) cout << dist[i] << " ";
  cout << '\n';
}
