#include <bits/stdc++.h>
using namespace std;
const int N = 12e5 + 10;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long powm(long long base, long long exp) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base) % mod;
    exp >>= 1, base = (base * base) % mod;
  }
  return ans;
}
vector<long long> graph[N];
vector<pair<long long, long long> > q[N];
bool vis[N];
long long ans[N];
long long dirty[N];
long long tree[N];
long long max_level;
void update(long long node, long long s, long long e, long long l, long long r,
            long long val) {
  if (dirty[node] != 0) {
    tree[node] += dirty[node] * (e - s + 1);
    if (s != e) {
      dirty[2 * node + 1] += dirty[node];
      dirty[2 * node + 2] += dirty[node];
    }
    dirty[node] = 0;
  }
  if (s > e || e < l || s > r) return;
  if (s >= l && e <= r) {
    tree[node] += (e - s + 1) * val;
    if (s != e) {
      dirty[2 * node + 1] += val;
      dirty[2 * node + 2] += val;
    }
    return;
  }
  long long mid = (s + e) / 2;
  update(2 * node + 1, s, mid, l, r, val);
  update(2 * node + 2, mid + 1, e, l, r, val);
  tree[node] = tree[2 * node + 1] + tree[2 * node + 2];
}
long long query(long long node, long long s, long long e, long long l,
                long long r) {
  if (dirty[node] != 0) {
    tree[node] += dirty[node] * (e - s + 1);
    if (s != e) {
      dirty[2 * node + 1] += dirty[node];
      dirty[2 * node + 2] += dirty[node];
    }
    dirty[node] = 0;
  }
  if (s > e || e < l || s > r) return 0;
  if (s >= l && e <= r) {
    return tree[node];
  }
  long long mid = (s + e) / 2;
  long long ans =
      query(2 * node + 1, s, mid, l, r) + query(2 * node + 2, mid + 1, e, l, r);
  return ans;
}
void find_level(long long v, long long level) {
  vis[v] = 1;
  max_level = max(level, max_level);
  for (long long i = 0; i < graph[v].size(); i++)
    if (!vis[graph[v][i]]) find_level(graph[v][i], level + 1);
}
void DFS(long long v, long long level) {
  vis[v] = 1;
  for (long long i = 0; i < q[v].size(); i++) {
    long long d = q[v][i].first;
    long long val = q[v][i].second;
    update(0, 0, max_level, level, min(max_level, level + d), val);
  }
  ans[v] = query(0, 0, max_level, level, level);
  for (long long i = 0; i < graph[v].size(); i++)
    if (!vis[graph[v][i]]) DFS(graph[v][i], level + 1);
  for (long long i = 0; i < q[v].size(); i++) {
    long long d = q[v][i].first;
    long long val = q[v][i].second;
    update(0, 0, max_level, level, min(max_level, level + d), -val);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, u, v, d, x, m;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> v >> d >> x;
    q[v].push_back(make_pair(min(d, n), x));
  }
  find_level(1, 1);
  for (long long i = 0; i < N; i++) vis[i] = 0;
  DFS(1, 1);
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
