import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;

class Node {
  public:
    int cur = -1;
    long sum = 0;
}

class Edge {
  public:
    int a;
    int b;
    int opCmp (const Edge e) const {
		  return (a < e.a) ? -1 : (a > e.a) ? 1 : (b < e.b) ? -1 : (b > e.b) ? 1 : 0;
	  }
}

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

  auto nodes = new Node[](n);
  foreach (i; 0..n) {
    nodes[i] = new Node();
  }
  
  auto edges = new int[][](n);
  
  foreach (i; 0..n-1) {
    int a, b;
    readf("%d %d\n", &a, &b);
    
    a--;
    b--;
    edges[a] ~= b;
    edges[b] ~= a;
  }

  auto que = BinaryHeap!(Edge[], "a > b")(new Edge[400000], 0);

  foreach (e; edges[0]) {
    auto edge = new Edge();
    edge.a = 0;
    edge.b = e;
    que.insert(edge);
  }

  nodes[0].cur = -2;
  while (!que.empty) {
    auto e = que.front;
    que.removeFront;
    if (nodes[e.b].cur != -1) {
      continue;
    }
    nodes[e.b].cur = e.a;

    foreach (ee; edges[e.b]) {
      auto edge = new Edge();
      edge.a = e.b;
      edge.b = ee;
      que.insert(edge);
    }
  }

  foreach (i; 0..q) {
    int p, x;
    readf("%d %d\n", &p, &x);
    p--;
    nodes[p].sum += x;
  }

  auto f = new long[](n);
  f[] = -1;

  long solve(int index) {
    if (f[index] != -1) {
      return f[index];
    }

    long res;
    res += nodes[index].sum;

    if (nodes[index].cur != -2) {
      res += solve(nodes[index].cur);
    }
    f[index] = res;
    return res;
  }

  foreach (i; 0..n) {
    solve(i);
  }

  writefln("%(%d %)", f);
}
