#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>

using namespace std;

#define maxN 200000

int edge[maxN][maxN];
int point[maxN];
int N, Q;

int make_tree(int n){
  for(int i=0;i<N; i++){
    if(edge[n][i] == -1){
      edge[i][n] = 0;
      make_tree(i);
    }
  }
  return 0;
}

int get_point(int n, int x){
  point[n] += x;
  for(int i=0;i<N; i++){
    if(edge[n][i] == -1){
      get_point(i,x);
    }
  }
  return 0;
}

int main(){

  cin >> N >> Q;
  memset(point, 0, sizeof(int)*N);

  for(int i=0; i<N-1;i++){
    int a, b;
    cin >> a >> b;
    edge[a-1][b-1] = -1;
    edge[b-1][a-1] = -1;
  }

  make_tree(0);

  for(int i=0; i<Q;i++){
    int a;
    int b;
    cin >> a >> b;
    get_point(a-1,b);
  }

  for(int i=0; i<N; i++){
    cout << point[i] << " ";
  }
  cout << endl;

  return 0;
}
