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

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

  public int count;

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

class Nodes {
  public Node[] nodes;

  this(int size) {
    this.nodes = new Node[size];
    size.iota.each!(i => this.nodes[i] = new Node(i));
  }

  void setPath(int from, int to) {
    this.nodes[from].subNodes ~= this.nodes[to];
    this.nodes[to].from = this.nodes[from];
  }

  Node root() {
    return this.nodes[0];
  }

  void apply(int id, void delegate(Node) d) {
    d(this.nodes[id]);
  }

  void applyAllFromRoot(void delegate(Node) d) {
    auto cursors = [this.root()];
    while(!cursors.empty) {
      foreach(node; cursors) d(node);
      cursors = cursors.map!(node => node.subNodes).joiner.filter!(node => node !is null).array;
    }
  }
}

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

  auto nodes = new Nodes(N);
  foreach(i; 1..N) {
    int from, to; readf("%d %d\n", &from, &to);
    nodes.setPath(from - 1, to - 1);
  }
  
  foreach(i; 0..Q) {
    int nodeId, increments; readf("%d %d\n", &nodeId, &increments);
    nodes.apply(nodeId - 1, (node){ node.count += increments; });
  }

  int[] totals = new int[N];
  nodes.applyAllFromRoot((node) {
    totals[node.id] += node.count;
    if (node.from) totals[node.id] += totals[node.from.id];
  });

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