#include <bits/stdc++.h>
using namespace std;
typedef struct _leaf {
  int father;
  int value;
} leaf;
map<int, leaf> Map;
int main() {
  int a, b;
  int n, i, q;
  int value;
  cin >> n;
  cin >> q;
  for (i = 0; i < n - 1; i++) {
    cin >> a;
    cin >> b;
    if (Map.count(a) == 0) {
      Map[a].value = 0;
      Map[a].father = 0;
    }
    Map[b].value = 0;
    Map[b].father = a;
  }
  for (i = 0; i < q; i++) {
    cin >> a;
    cin >> value;
    if (Map.count(a) == 1) {
      Map[a].value += value;
    } else {
    }
  }
  map<int, leaf>::iterator iter;
  for (iter = Map.begin(); iter != Map.end(); iter++) {
    if (iter != Map.begin())
      (*iter).second.value += Map[(*iter).second.father].value;
  }
  for (iter = Map.begin(); iter != Map.end(); iter++) {
    cout << (*iter).second.value << " ";
  }
  return 0;
}
