#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = 1e9;
inline long long pwr(long long base, long long n, long long m) {
  long long ans = 1;
  while (n > 0) {
    if (n % 2 == 1) ans = (ans * base) % m;
    base = (base * base) % m;
    n /= 2;
  }
  return ans;
}
const int N = 3e5 + 10;
vector<int> adj[N];
int lvl[N], n, m;
vector<pair<long long, int> > q[N];
long long ans[N], l[N];
void dfs(int x, int y) {
  if (x != y) lvl[x] = lvl[y] + 1;
  for (auto i : adj[x]) {
    if (i != y) dfs(i, x);
  }
}
void dfs1(int x, int y, long long temp) {
  for (auto i : q[x]) {
    int d1 = i.second;
    long long c = i.first;
    l[lvl[x]] += c;
    if (lvl[x] + d1 + 1 < N) l[lvl[x] + d1 + 1] -= c;
  }
  temp += l[lvl[x]];
  ans[x] += temp;
  for (auto i : adj[x]) {
    if (i != y) dfs1(i, x, temp);
  }
  for (auto i : q[x]) {
    int d1 = i.second;
    long long c = i.first;
    l[lvl[x]] -= c;
    if (lvl[x] + d1 + 1 < N) l[lvl[x] + d1 + 1] += c;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  lvl[1] = 0;
  dfs(1, 1);
  cin >> m;
  while (m--) {
    long long v, d, x;
    cin >> v >> d >> x;
    q[v].push_back(make_pair(x, d));
  }
  dfs1(1, 1, 0);
  for (int i = 0; i < n; i++) cout << ans[i + 1] << " ";
  return 0;
}
