#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int nodeCount = a;
  int dataCount = b;
  int* parents = new int[nodeCount]{0};
  parents[0] = -1;
  for (int i = 1; i < nodeCount; i++) {
    cin >> a >> b;
    parents[b - 1] = a - 1;
  }
  int* nodes = new int[nodeCount]{0};
  for (int i = 0; i < dataCount; i++) {
    cin >> a >> b;
    nodes[a - 1] += b;
  }
  for (int i = 0; i < nodeCount; i++) {
    int ret = nodes[i];
    int parent = parents[i];
    while (parent != -1) {
      ret += nodes[parent];
      parent = parents[parent];
    }
    if (i != 0) cout << " ";
    cout << ret;
  }
}
