#include <bits/stdc++.h>
using namespace std;
const int N = 6e5 + 5;
const int mod = 1e9 + 7;
int n, m, t, q;
vector<int> G[N], H[N];
map<int, int> M;
set<int> S;
struct p {
  int x, y;
};
int st[N], ed[N], tot = 1;
int vis[N], node[N], maxx = 0;
long long ans[N], ans2[N];
void dfs(int x, int fa, int dep) {
  maxx = max(maxx, dep);
  node[tot] = x;
  vis[x] = dep;
  st[x] = tot++;
  int sz = G[x].size();
  for (int i = (0); i <= (sz - 1); i++) {
    if (G[x][i] == fa) continue;
    dfs(G[x][i], x, dep + 1);
  }
  ed[x] = tot;
}
void dfsans(int x, long long sum, int fa) {
  sum = sum + ans[x] + ans2[x];
  ans[x] = sum;
  int sz = G[x].size();
  for (int i = (0); i <= (sz - 1); i++) {
    if (G[x][i] == fa) continue;
    dfsans(G[x][i], sum, x);
  }
}
int main() {
  scanf("%d", &n);
  int u, v;
  for (int i = (1); i <= (n - 1); i++) {
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, -1, 1);
  for (int i = (1); i <= (n); i++) H[vis[i]].push_back(st[i]);
  for (int i = (1); i <= (n); i++) sort(H[i].begin(), H[i].end());
  scanf("%d", &m);
  long long x, dep, val;
  for (int i = (1); i <= (m); i++) {
    scanf("%lld%lld%lld", &x, &dep, &val);
    ans2[x] += val;
    dep = dep + vis[x] + 1;
    if (dep > maxx)
      continue;
    else {
      int idl =
          lower_bound(H[dep].begin(), H[dep].end(), st[x]) - H[dep].begin();
      int idr =
          lower_bound(H[dep].begin(), H[dep].end(), ed[x]) - H[dep].begin();
      int sz = H[dep].size();
      if (idl >= sz)
        continue;
      else {
        ans[node[H[dep][idl]]] -= val;
        if (idr != sz) ans[node[H[dep][idr]]] += val;
      }
    }
  }
  for (int i = (1); i <= (maxx); i++) {
    int sz = H[i].size();
    long long sum = 0;
    for (int j = (0); j <= (sz - 1); j++) {
      sum = sum + ans[node[H[i][j]]];
      ans[node[H[i][j]]] = sum;
    }
  }
  dfsans(1, 0, -1);
  for (int i = (1); i <= (n); i++) printf("%lld ", ans[i]);
  return 0;
}
