import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;

class Node {
  public int id;
  public int count;
  public Node from;
  public Node[] subNodes;

  this(int id) {
    this.id = id;
  }
}

void main() {
  int N, Q; readf("%d %d\n", &N, &Q);

  Node[] nodes = new Node[N];
  N.iota.each!(i => nodes[i] = new Node(i));
  foreach(i; 0..N-1) {
    int from, to; readf("%d %d\n", &from, &to);
    from--; to--;
    nodes[to].from = nodes[from];
    nodes[from].subNodes ~= nodes[to];
  }
  
  foreach(i; 0..Q) {
    int nodeId, increments; readf("%d %d\n", &nodeId, &increments);
    nodes[nodeId - 1].count += increments;
  }

  int[] totals = new int[N];
  auto tree = [nodes[0]];
  while(!tree.empty) {
    foreach(node; tree) {
      totals[node.id] += node.count;
      if (node.from) totals[node.id] += totals[node.from.id];
    }
    tree = tree.map!(node => node.subNodes).joiner.filter!(node => node !is null).array;
  }

  totals.to!(string[]).join(" ").writeln;
}
