#include <bits/stdc++.h>
using std::cin;
using std::cout;
using llong = long long;
using llong_lambda = std::function<llong(llong, llong)>;
template <typename T>
using graph = std::vector<std::vector<T>>;
template <typename T1, typename T2>
using queries_type = std::vector<std::vector<std::pair<T1, T2>>>;
template <typename T, typename Func>
class SegmentTree {
 public:
  SegmentTree(int size, Func func, T neutral)
      : size_(size),
        data_(4 * size, neutral),
        update_(4 * size, neutral),
        func_(std::move(func)),
        neutral_(neutral) {}
  T Get(int left_border, int right_border) {
    return Get(0, 0, size_ - 1, left_border, right_border);
  }
  void Modify(int left_border, int right_border, T value) {
    Modify(0, 0, size_ - 1, left_border, right_border, value);
  }

 private:
  int size_;
  std::vector<T> data_, update_;
  Func func_;
  T neutral_;
  void Push(int vertex, int left_pointer, int right_pointer) {
    if (update_[vertex] == neutral_) {
      return;
    }
    data_[vertex] += (right_pointer - left_pointer + 1) * update_[vertex];
    if (left_pointer != right_pointer) {
      update_[2 * vertex + 1] += update_[vertex];
      update_[2 * vertex + 2] += update_[vertex];
    }
    update_[vertex] = neutral_;
  }
  T Get(int vertex, int left_pointer, int right_pointer, int left_border,
        int right_border) {
    Push(vertex, left_pointer, right_pointer);
    if (left_pointer > right_border || right_pointer < left_border) {
      return neutral_;
    }
    if (left_border <= left_pointer && right_pointer <= right_border) {
      return data_[vertex];
    }
    int middle_pointer = (left_pointer + right_pointer) / 2;
    T left_sum = Get(2 * vertex + 1, left_pointer, middle_pointer, left_border,
                     right_border);
    T right_sum = Get(2 * vertex + 2, middle_pointer + 1, right_pointer,
                      left_border, right_border);
    return func_(left_sum, right_sum);
  }
  void Modify(int vertex, int left_pointer, int right_pointer, int left_border,
              int right_border, T value) {
    Push(vertex, left_pointer, right_pointer);
    if (left_pointer > right_border || right_pointer < left_border) {
      return;
    }
    if (left_border <= left_pointer && right_pointer <= right_border) {
      update_[vertex] = value;
      Push(vertex, left_pointer, right_pointer);
      return;
    }
    int middle_pointer = (left_pointer + right_pointer) / 2;
    Modify(2 * vertex + 1, left_pointer, middle_pointer, left_border,
           right_border, value);
    Modify(2 * vertex + 2, middle_pointer + 1, right_pointer, left_border,
           right_border, value);
    data_[vertex] = func_(data_[2 * vertex + 1], data_[2 * vertex + 2]);
  }
};
void Dfs(int vertex, int parent, int depth, const graph<int>& g,
         SegmentTree<llong, llong_lambda>* tree,
         const queries_type<int, int>& queries, std::vector<llong>* answer) {
  for (auto elem : queries[vertex]) {
    tree->Modify(depth, depth + elem.first, elem.second);
  }
  (*answer)[vertex] = tree->Get(depth, depth);
  for (const auto& to : g[vertex]) {
    if (to == parent) {
      continue;
    }
    Dfs(to, vertex, depth + 1, g, tree, queries, answer);
  }
  for (const auto& elem : queries[vertex]) {
    tree->Modify(depth, depth + elem.first, -elem.second);
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  const llong_lambda sum_func = [](llong x, llong y) { return x + y; };
  SegmentTree<llong, llong_lambda> tree(n, sum_func, 0);
  graph<int> g(static_cast<size_t>(n));
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  int queries_number;
  cin >> queries_number;
  queries_type<int, int> queries(static_cast<size_t>(n));
  for (int i = 0; i < queries_number; ++i) {
    int vertex, depth, value;
    cin >> vertex >> depth >> value;
    --vertex;
    queries[vertex].emplace_back(depth, value);
  }
  std::vector<llong> answer(static_cast<size_t>(n));
  Dfs(0, -1, 0, g, &tree, queries, &answer);
  for (const auto& elem : answer) {
    cout << elem << " ";
  }
  return 0;
}
