#include <bits/stdc++.h>
using namespace std;
typedef struct {
  vector<int> leafs;
  int id, left, right, sum;
} node;
vector<node> nodes;
vector<int> ary;
void print_node(int id) {
  printf("====== %d ======\n", id);
  printf("leafs : ");
  int size = nodes[id].leafs.size();
  for (int i = (0); i <= ((size)-1); ++i) {
    printf(" %d", nodes[id].leafs[i]);
  }
  printf("\nleft : %d\n", nodes[id].left);
  printf("right : %d\n", nodes[id].right);
  printf("sum : %d\n", nodes[id].sum);
}
int dfs(int id, int begin_no) {
  int curr = begin_no;
  ary.push_back(id);
  nodes[id].left = curr++;
  int size = nodes[id].leafs.size();
  for (int i = (0); i <= ((size)-1); ++i) {
    curr = dfs(nodes[id].leafs[i], curr);
  }
  nodes[id].right = curr;
  ary.push_back(id);
  return nodes[id].right + 1;
}
int main(int argc, const char* argv[]) {
  int n, q;
  cin >> n >> q;
  for (int i = (0); i <= ((n)-1); ++i) {
    node nd;
    nd.id = i;
    nodes.push_back(nd);
  }
  for (int i = (0); i <= ((n - 1) - 1); ++i) {
    int a, b;
    cin >> a >> b;
    nodes[a - 1].leafs.push_back(b - 1);
  }
  dfs(0, 0);
  for (int i = (0); i <= ((q)-1); ++i) {
    int p, x;
    cin >> p >> x;
    int l, r;
    l = nodes[p - 1].left;
    r = nodes[p - 1].right;
    for (int j = (l); j <= (r); ++j) {
      if (j == nodes[ary[j]].left) {
        nodes[ary[j]].sum += x;
      }
    }
  }
  for (int i = (0); i <= ((n)-1); ++i) {
    printf("%d ", nodes[i].sum);
  }
  return 0;
}
