#include <bits/stdc++.h>
class Node {
 public:
  long counter = 0;
  std::vector<Node *> children;
};
void add_counter(Node *n, long v) {
  n->counter += v;
  for (auto c : n->children) {
    add_counter(c, n->counter);
  }
}
int main() {
  int n = 0, q = 0;
  std::cin >> n >> q;
  Node nodes[n];
  for (int i = 0; i < n - 1; i++) {
    int a = 0, b = 0;
    std::cin >> a >> b;
    nodes[a - 1].children.push_back(&nodes[b - 1]);
  }
  for (int i = 0; i < q; i++) {
    int p = 0, x = 0;
    std::cin >> p >> x;
    nodes[p - 1].counter += x;
  }
  add_counter(&nodes[0], 0);
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      std::cout << " ";
    }
    std::cout << nodes[i].counter;
  }
}
