import queue

import sys

input = sys.stdin.readline



N,Q=list(map(int,input().split()))

c=[0]*N#count



to=[[] for i in range(N)]



for i in range(N-1):

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

    a-=1

    b-=1

    to[a].append(b)

    to[b].append(a)

    

    

for i in range(Q):

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

    p-=1

    c[p]+=x

    

q=queue.Queue()

q.put((0,-1))





while not q.empty():

    v,prev=q.get()

    for i in range(len(to[v])):

        v_next=to[v][i]

        if v_next!=prev:

            q.put((v_next,v))

            c[v_next]+=c[v]



        

print((' '.join(map(str, c))))
import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=10**9+7

    import queue

    N,Q=MI()

    adj=[[]for _ in range(N)]

    for _ in range(N-1):

        a,b=MI()

        a-=1

        b-=1

        adj[a].append(b)

        adj[b].append(a)

        

    ans=[0]*N

    for _ in range(Q):

        p,x=MI()

        p-=1

        ans[p]+=x

        

    q=queue.Queue()

    q.put((0,-1))

    

    while not q.empty():

        v,p=q.get()

        for nv in adj[v]:

            if nv!=p:

                ans[nv]+=ans[v]

                q.put((nv,v))

                

    print((' '.join(map(str, ans))))

        

    



main()

import queue
import sys

input = sys.stdin.readline
N, Q = list(map(int, input().split()))
c = [0] * N  # count
to = [[] for i in range(N)]
for i in range(N - 1):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
for i in range(Q):
    p, x = list(map(int, input().split()))
    p -= 1
    c[p] += x
q = queue.Queue()
q.put((0, -1))
while not q.empty():
    v, prev = q.get()
    for i in range(len(to[v])):
        v_next = to[v][i]
        if v_next != prev:
            q.put((v_next, v))
            c[v_next] += c[v]
print((" ".join(map(str, c))))

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 10**9 + 7
    import queue

    N, Q = MI()
    adj = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = MI()
        a -= 1
        b -= 1
        adj[a].append(b)
        adj[b].append(a)
    ans = [0] * N
    for _ in range(Q):
        p, x = MI()
        p -= 1
        ans[p] += x
    q = queue.Queue()
    q.put((0, -1))
    while not q.empty():
        v, p = q.get()
        for nv in adj[v]:
            if nv != p:
                ans[nv] += ans[v]
                q.put((nv, v))
    print((" ".join(map(str, ans))))


main()

-import queue -N, Q = list(map(int, input().split())) -c = [0] * N  # count -to = [[] for i in range(N)] -for i in range(N - 1): -    a, b = list(map(int, input().split())) -    a -= 1 -    b -= 1 -    to[a].append(b) -    to[b].append(a) -for i in range(Q): -    p, x = list(map(int, input().split())) -    p -= 1 -    c[p] += x -q = queue.Queue() -q.put((0, -1)) -while not q.empty(): -    v, prev = q.get() -    for i in range(len(to[v])): -        v_next = to[v][i] -        if v_next != prev: -            q.put((v_next, v)) -            c[v_next] += c[v] -print((" ".join(map(str, c)))) + + +def I(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def main(): +    mod = 10**9 + 7 +    import queue + +    N, Q = MI() +    adj = [[] for _ in range(N)] +    for _ in range(N - 1): +        a, b = MI() +        a -= 1 +        b -= 1 +        adj[a].append(b) +        adj[b].append(a) +    ans = [0] * N +    for _ in range(Q): +        p, x = MI() +        p -= 1 +        ans[p] += x +    q = queue.Queue() +    q.put((0, -1)) +    while not q.empty(): +        v, p = q.get() +        for nv in adj[v]: +            if nv != p: +                ans[nv] += ans[v] +                q.put((nv, v)) +    print((" ".join(map(str, ans)))) + + +main()