#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
inline int nxt() {
  int a;
  scanf("%d", &a);
  return a;
}
inline long long int NXT() {
  long long int a;
  scanf("%lld", &a);
  return a;
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
template <class T>
inline T bigmod(T p, T e, T m) {
  T ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % m;
    p = (p * p) % m;
  }
  return (T)ret;
}
template <class T>
inline T biton(T n, T pos) {
  return n | ((T)1 << pos);
}
template <class T>
inline T bitoff(T n, T pos) {
  return n & ~((T)1 << pos);
}
template <class T>
inline T bitcheck(T n, T pos) {
  return (bool)(n & ((T)1 << pos));
}
template <class T>
inline T gcd(T a, T b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
vector<pair<long long int, long long int> > qu[100010 * 3];
vector<int> graph[100010 * 3];
long long int ans[100010 * 3];
long long int tree[100010 * 10];
void update(int lower, int upper, long long int x, int limit) {
  int a = min(lower, limit);
  int b = min(upper, limit);
  b++;
  while (a <= limit) {
    tree[a] += x;
    a += a & -a;
  }
  while (b <= limit) {
    tree[b] += -x;
    b += b & -b;
  }
}
long long int query(int pos) {
  long long int sum = 0;
  while (pos > 0) {
    sum += tree[pos];
    pos -= pos & -pos;
  }
  return sum;
}
void dfs(int node, int limit, int depth, int parent) {
  for (auto i : qu[node]) {
    update(depth, depth + i.first, i.second, limit);
  }
  ans[node] = query(depth);
  for (auto i : graph[node]) {
    if (parent == i) continue;
    dfs(i, limit, depth + 1, node);
  }
  for (auto i : qu[node]) {
    update(depth, depth + i.first, -i.second, limit);
  }
  return;
}
int main() {
  int n = nxt();
  for (int i = 0; i < n - 1; i++) {
    int x = nxt(), y = nxt();
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  int q = nxt();
  for (int i = 0; i < q; i++) {
    int x = nxt();
    int y = nxt(), v = nxt();
    qu[x].push_back(make_pair(y, v));
  }
  dfs(1, n + 2, 1, -1);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
