from collections import deque

n,q=list(map(int,input().split()))

K=[set() for _ in range(n)]

V=[False]*n

P=[0]*n

for i in range(n-1):

      a,b=list(map(int,input().split()))

      K[a-1].add(b-1)

      K[b-1].add(a-1)

for i in range(q):

      c,d=list(map(int,input().split()))

      P[c-1]+=d

que=deque([0])

while que:

      s=que.popleft()

      V[s]=True

      for ni in K[s]:

            if V[ni]==False:

                  P[ni]+=P[s]

                  que.append(ni)

print((*P))
from collections import deque



n,q=list(map(int,input().split()))

E=[[] for _ in range(n)]

P=[0]*n

V=[False]*n

for i in range(n-1):

    a,b=list(map(int,input().split()))

    E[a-1].append(b-1)

    E[b-1].append(a-1)

for i in range(q):

    p,x=list(map(int,input().split()))

    P[p-1]+=x



que=deque([0])

while que:

    s=que.popleft()

    V[s]=True

    for ni in E[s]:

        if V[ni]==False:

            P[ni]+=P[s]

            que.append(ni)

print((*P))
from collections import deque

n, q = list(map(int, input().split()))
K = [set() for _ in range(n)]
V = [False] * n
P = [0] * n
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    K[a - 1].add(b - 1)
    K[b - 1].add(a - 1)
for i in range(q):
    c, d = list(map(int, input().split()))
    P[c - 1] += d
que = deque([0])
while que:
    s = que.popleft()
    V[s] = True
    for ni in K[s]:
        if V[ni] == False:
            P[ni] += P[s]
            que.append(ni)
print((*P))

from collections import deque

n, q = list(map(int, input().split()))
E = [[] for _ in range(n)]
P = [0] * n
V = [False] * n
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    E[a - 1].append(b - 1)
    E[b - 1].append(a - 1)
for i in range(q):
    p, x = list(map(int, input().split()))
    P[p - 1] += x
que = deque([0])
while que:
    s = que.popleft()
    V[s] = True
    for ni in E[s]:
        if V[ni] == False:
            P[ni] += P[s]
            que.append(ni)
print((*P))

-K = [set() for _ in range(n)] +E = [[] for _ in range(n)] +P = [0] * n -P = [0] * n -    K[a - 1].add(b - 1) -    K[b - 1].add(a - 1) +    E[a - 1].append(b - 1) +    E[b - 1].append(a - 1) -    c, d = list(map(int, input().split())) -    P[c - 1] += d +    p, x = list(map(int, input().split())) +    P[p - 1] += x -    for ni in K[s]: +    for ni in E[s]: