#include <bits/stdc++.h>
using namespace std;
typedef struct tree_st {
  int counter;
  int num;
  int next[200000];
} Tree;
void culc(int p, int x, Tree* tree) {
  tree[p].counter += x;
  for (int i = 0; i < tree[p].num; i++) {
    culc(tree[p].next[i], x, tree);
  }
}
int main(void) {
  int N, Q;
  int a, b;
  int p, x;
  cin >> N >> Q;
  Tree* tree = (Tree*)malloc(sizeof(Tree) * (N + 1));
  for (int i = 0; i < N + 1; i++) {
    tree[i].counter = 0;
    tree[i].num = 0;
  }
  for (int i = 0; i < N - 1; i++) {
    cin >> a >> b;
    tree[a].next[tree[a].num] = b;
    tree[a].num++;
  }
  for (int i = 0; i < Q; i++) {
    cin >> p >> x;
    culc(p, x, tree);
  }
  for (int i = 0; i < N; i++) {
    cout << tree[i + 1].counter;
    if (i != N - 1) {
      cout << " ";
    }
  }
  cout << endl;
  return 0;
}
