#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
template <class S, class T>
ostream &operator<<(ostream &os, pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long inf = 1000000001;
const long long INF = 1e18;
const long long MOD = 1000000007;
const double pi = 3.14159265358979323846;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy2[8] = {0, 1, 1, 1, 0, -1, -1, -1};
class LazySegmentTree {
 public:
  int n;
  vector<long long> node, lazy;
  LazySegmentTree(vector<long long> a) {
    int _n = a.size();
    n = 1;
    while (n < _n) n *= 2;
    node.resize(2 * n - 1);
    lazy.resize(2 * n - 1, 0);
    for (int i = 0; i < _n; i++) node[i + n - 1] = a[i];
    for (int i = n - 2; i >= 0; i--) {
      node[i] = node[i * 2 + 1] + node[i * 2 + 2];
    }
  }
  inline void eval(int k, int l, int r) {
    if (lazy[k] != 0) {
      node[k] += (r - l) * lazy[k];
      if (r - l > 1) {
        lazy[2 * k + 1] += lazy[k];
        lazy[2 * k + 2] += lazy[k];
      }
      lazy[k] = 0;
    }
  }
  void add(int a, int b, long long x, int k, int l, int r) {
    eval(k, l, r);
    if (b <= l || r <= a) return;
    if (a <= l && r <= b) {
      lazy[k] += x;
      eval(k, l, r);
    } else {
      add(a, b, x, 2 * k + 1, l, (l + r) / 2);
      add(a, b, x, 2 * k + 2, (l + r) / 2, r);
      node[k] = node[2 * k + 1] + node[2 * k + 2];
    }
  }
  long long getsum(int a, int b, int k, int l, int r) {
    eval(k, l, r);
    if (b <= l || r <= a) return 0;
    if (a <= l && r <= b) return node[k];
    long long resl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
    long long resr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);
    return resl + resr;
  }
};
const int N = 300010;
vector<vector<int> > G(N), tree(N);
vector<int> parent(N, -1);
vector<int> depth(N);
vector<vector<pair<long long, long long> > > q(N);
vector<long long> ans(N);
vector<long long> tmp(N);
LazySegmentTree lst(tmp);
void dfs1(int now, int par) {
  parent[now] = par;
  for (int i = 0; i < (G[now].size()); i++) {
    if (G[now][i] == par) continue;
    dfs1(G[now][i], now);
  }
}
void dfs2(int now, int depth) {
  for (int i = 0; i < (q[now].size()); i++) {
    long long d = q[now][i].first, x = q[now][i].second;
    lst.add(depth, min(depth + d + 1, (long long)N), x, 0, 0, lst.n);
  }
  ans[now] = lst.getsum(depth, depth + 1, 0, 0, lst.n);
  for (int i = 0; i < (tree[now].size()); i++) {
    dfs2(tree[now][i], depth + 1);
  }
  for (int i = 0; i < (q[now].size()); i++) {
    long long d = q[now][i].first, x = q[now][i].second;
    lst.add(depth, min(depth + d + 1, (long long)N), -x, 0, 0, lst.n);
  }
}
int main() {
  int n;
  scanf(" %d", &n);
  for (int i = 0; i < (n - 1); i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs1(0, -1);
  for (int i = 1; i <= (n - 1); i++) {
    tree[parent[i]].push_back(i);
  }
  for (int i = 0; i < (n); i++) {
    sort(tree[i].begin(), tree[i].end());
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < (m); i++) {
    int u, d, x;
    scanf("%d %d %d", &u, &d, &x);
    u--;
    q[u].push_back(pair<long long, long long>(d, x));
  }
  dfs2(0, 0);
  for (int i = 0; i < (n); i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
