using System;
class Tree{
  public static void Main(){
    string[] e = Console.ReadLine().Split(' ');
    int count = int.Parse(e[0]);
    int sum_count = int.Parse(e[1]);

    int[,] tree = new int[count+1,count+1];
    int[] operation = new int[count+1];
    for (int i = 1; i<=count+1; i++) {
      tree[i,0]=i;
    }
    for (int i = 0; i<count-1; i++) {
      string[] s = Console.ReadLine().Split(' ');
      int a = int.Parse(s[0]);
      int b = int.Parse(s[1]);
      int j = 1;
      while(tree[a,j]!=0){
        j++;
      }
      tree[a,j]=b;
    }

      for (int i=count; i>0;i--){
        int[] stack = new int[count];
        int k = 1;
        int y = 1;
        while(tree[i,y]!=0){
          y++;
        }
        while(tree[i,k]!=0){
          int buka = tree[i,k];
          int buka_count = 0;
          while(tree[buka,buka_count]!=0){
            stack[buka_count]=tree[buka,buka_count];
            buka_count++;
          }
          for (int j=0; j<buka_count; j++) {
            tree[i,y]=stack[j];
            y++;
          }
          k++;
        }
      }

for (int i = 0; i<sum_count; i++) {
  string[] r = Console.ReadLine().Split(' ');
  int p = int.Parse(r[0]);
  int x = int.Parse(r[1]);
  int tree_count = 0;
  while(tree[p,tree_count]!=0){
    int v = tree[p,tree_count];
    operation[v]+=x;
    tree_count++;
  }
}

for (int i=1; i<count+1; i++) {
  Console.Write("{0} ",operation[i]);
}

    /*
    for (int i=count; i>0;i--){
      int k=1;

      int y = 1;
      while(tree[i,y]!=0){
        y++;
      }
      while(tree[i,k]!=0){
        int j = tree[i,k];
        int u=1;
        int m = tree[i,u];
        while(tree[j,u]!=0){
          tree[i,y]=tree[m,u];
          y++;
          u++;

        }
        k++;
      }
    }
    */
  }
}
