Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i.  Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.  Now, the following Q operations will be performed:    * Operation j (1 \leq j \leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.  Find the value of the counter on each vertex after all operations.
N, Q = [int(nq) for nq in input().split()]
AB = []
for i in range(N - 1):
  ab = [int(ab) for ab in input().split()]
  AB.append(ab)
AB.sort()
P, X = [], []
for j in range(Q):
  p, x = [int(px) for px in input().split()]
  P.append(p)
  X.append(x)

Score = [0] * N
for j in range(Q):
  Score[P[j] - 1] += X[j]

for i in range(N - 1):
  a, b = AB[i]
  Score[b - 1] += Score[a - 1]

ans = ""
for k in range(N):
  ans += str(Score[i]) + " "

print(ans)
N, Q = [int(nq) for nq in input().split()]
AB = []
for i in range(N):
  AB.append([])
for i in range(N - 1):
  a, b = [int(ab) for ab in input().split()]
  AB[a - 1].append(b)
  AB[b - 1].append(a)

P, X = [], []
for j in range(Q):
  p, x = [int(px) for px in input().split()]
  P.append(p)
  X.append(x)

Score = [0] * N
for j in range(Q):
  Score[P[j] - 1] += X[j]

Exists = [0] * N

Now = []
Next = [1]
Exists[1 - 1] = 1

while Next != []:
  Now = Next
  Next = []
  for nw in Now:
    for nxt in AB[nw - 1]:
      if Exists[nxt - 1] == 0:
        Exists[nxt - 1] = 1
        Score[nxt - 1] += Score[nw - 1]
        Next.append(nxt)

print(*Score)