

from collections import deque



icase=0

if icase==0:

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

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

    for i in range(n-1):

        ai,bi=list(map(int,input().split()))

        g[ai-1].add(bi-1)

        g[bi-1].add(ai-1)

    g=tuple(g)

    xx=[0]*n

    for i in range(q):

        pi,xi=list(map(int,input().split()))

        xx[pi-1]=xx[pi-1]+xi

elif icase==2:

    n,q=4,3

    g = [deque([]) for _ in range(n)]

    g[0]=deque([1])

    g[1]=deque([0,2,3])

    g[2]=deque([1])

    g[3]=deque([1])

    p=[0]*q

    x=[0]*q

    p[0]=1

    x[0]=10    

    p[1]=0

    x[1]=100

    p[2]=2

    x[2]=1    

    xx=[0]*n

    for i in range(q):

        xx[p[i]]=xx[p[i]]+x[i]

#ans:100 110 111 110

elif icase==3:

    n,q=6,2

    g = [deque([]) for _ in range(n)]

    g[0]=deque([1,2])

    g[1]=deque([0,3,4])

    g[2]=deque([0,5])

    g[3]=deque([1])

    g[4]=deque([1])

    g[5]=deque([2])

    p=[0]*q

    x=[0]*q

    p[0]=0

    x[0]=10    

    p[1]=0

    x[1]=10    

    xx=[0]*n

    for i in range(q):

#        pi,xi=map(int,input().split())

        xx[p[i]]=xx[p[i]]+x[i]

        

#q = deque([0])

stack=[0]

parent=[-1]*n

while stack:

#    print(q)

    state = stack.pop()

#    print("------------- stack:",stack,"state:",state,"g:",g[state])

    for v in g[state]:

#        print("state:",state,"v:",v,"q:",q)

        if parent[state] == v:

            continue

        else:

            parent[v]=state

            stack.append(v)

            xx[v]+=xx[state]

#            print("parent:",parent,"xx:",xx,"stack",stack)



print((" ".join(map(str,xx[0: ]))))

import sys

input = sys.stdin.readline

from collections import deque



icase=0

if icase==0:

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

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

    for i in range(n-1):

        ai,bi=list(map(int,input().split()))

        g[ai-1].add(bi-1)

        g[bi-1].add(ai-1)

    g=tuple(g)

    xx=[0]*n

    for i in range(q):

        pi,xi=list(map(int,input().split()))

        xx[pi-1]=xx[pi-1]+xi

elif icase==2:

    n,q=4,3

    g = [deque([]) for _ in range(n)]

    g[0]=deque([1])

    g[1]=deque([0,2,3])

    g[2]=deque([1])

    g[3]=deque([1])

    p=[0]*q

    x=[0]*q

    p[0]=1

    x[0]=10    

    p[1]=0

    x[1]=100

    p[2]=2

    x[2]=1    

    xx=[0]*n

    for i in range(q):

        xx[p[i]]=xx[p[i]]+x[i]

#ans:100 110 111 110

elif icase==3:

    n,q=6,2

    g = [deque([]) for _ in range(n)]

    g[0]=deque([1,2])

    g[1]=deque([0,3,4])

    g[2]=deque([0,5])

    g[3]=deque([1])

    g[4]=deque([1])

    g[5]=deque([2])

    p=[0]*q

    x=[0]*q

    p[0]=0

    x[0]=10    

    p[1]=0

    x[1]=10    

    xx=[0]*n

    for i in range(q):

#        pi,xi=map(int,input().split())

        xx[p[i]]=xx[p[i]]+x[i]

        

#q = deque([0])

stack=[0]

parent=[-1]*n

while stack:

#    print(q)

    state = stack.pop()

#    print("------------- stack:",stack,"state:",state,"g:",g[state])

    for v in g[state]:

#        print("state:",state,"v:",v,"q:",q)

        if parent[state] == v:

            continue

        else:

            parent[v]=state

            stack.append(v)

            xx[v]+=xx[state]

#            print("parent:",parent,"xx:",xx,"stack",stack)



print((" ".join(map(str,xx[0: ]))))

from collections import deque

icase = 0
if icase == 0:
    n, q = list(map(int, input().split()))
    g = [set() for _ in range(n)]
    for i in range(n - 1):
        ai, bi = list(map(int, input().split()))
        g[ai - 1].add(bi - 1)
        g[bi - 1].add(ai - 1)
    g = tuple(g)
    xx = [0] * n
    for i in range(q):
        pi, xi = list(map(int, input().split()))
        xx[pi - 1] = xx[pi - 1] + xi
elif icase == 2:
    n, q = 4, 3
    g = [deque([]) for _ in range(n)]
    g[0] = deque([1])
    g[1] = deque([0, 2, 3])
    g[2] = deque([1])
    g[3] = deque([1])
    p = [0] * q
    x = [0] * q
    p[0] = 1
    x[0] = 10
    p[1] = 0
    x[1] = 100
    p[2] = 2
    x[2] = 1
    xx = [0] * n
    for i in range(q):
        xx[p[i]] = xx[p[i]] + x[i]
# ans:100 110 111 110
elif icase == 3:
    n, q = 6, 2
    g = [deque([]) for _ in range(n)]
    g[0] = deque([1, 2])
    g[1] = deque([0, 3, 4])
    g[2] = deque([0, 5])
    g[3] = deque([1])
    g[4] = deque([1])
    g[5] = deque([2])
    p = [0] * q
    x = [0] * q
    p[0] = 0
    x[0] = 10
    p[1] = 0
    x[1] = 10
    xx = [0] * n
    for i in range(q):
        #        pi,xi=map(int,input().split())
        xx[p[i]] = xx[p[i]] + x[i]
# q = deque([0])
stack = [0]
parent = [-1] * n
while stack:
    #    print(q)
    state = stack.pop()
    #    print("------------- stack:",stack,"state:",state,"g:",g[state])
    for v in g[state]:
        #        print("state:",state,"v:",v,"q:",q)
        if parent[state] == v:
            continue
        else:
            parent[v] = state
            stack.append(v)
            xx[v] += xx[state]
#            print("parent:",parent,"xx:",xx,"stack",stack)
print((" ".join(map(str, xx[0:]))))

import sys

input = sys.stdin.readline
from collections import deque

icase = 0
if icase == 0:
    n, q = list(map(int, input().split()))
    g = [set() for _ in range(n)]
    for i in range(n - 1):
        ai, bi = list(map(int, input().split()))
        g[ai - 1].add(bi - 1)
        g[bi - 1].add(ai - 1)
    g = tuple(g)
    xx = [0] * n
    for i in range(q):
        pi, xi = list(map(int, input().split()))
        xx[pi - 1] = xx[pi - 1] + xi
elif icase == 2:
    n, q = 4, 3
    g = [deque([]) for _ in range(n)]
    g[0] = deque([1])
    g[1] = deque([0, 2, 3])
    g[2] = deque([1])
    g[3] = deque([1])
    p = [0] * q
    x = [0] * q
    p[0] = 1
    x[0] = 10
    p[1] = 0
    x[1] = 100
    p[2] = 2
    x[2] = 1
    xx = [0] * n
    for i in range(q):
        xx[p[i]] = xx[p[i]] + x[i]
# ans:100 110 111 110
elif icase == 3:
    n, q = 6, 2
    g = [deque([]) for _ in range(n)]
    g[0] = deque([1, 2])
    g[1] = deque([0, 3, 4])
    g[2] = deque([0, 5])
    g[3] = deque([1])
    g[4] = deque([1])
    g[5] = deque([2])
    p = [0] * q
    x = [0] * q
    p[0] = 0
    x[0] = 10
    p[1] = 0
    x[1] = 10
    xx = [0] * n
    for i in range(q):
        #        pi,xi=map(int,input().split())
        xx[p[i]] = xx[p[i]] + x[i]
# q = deque([0])
stack = [0]
parent = [-1] * n
while stack:
    #    print(q)
    state = stack.pop()
    #    print("------------- stack:",stack,"state:",state,"g:",g[state])
    for v in g[state]:
        #        print("state:",state,"v:",v,"q:",q)
        if parent[state] == v:
            continue
        else:
            parent[v] = state
            stack.append(v)
            xx[v] += xx[state]
#            print("parent:",parent,"xx:",xx,"stack",stack)
print((" ".join(map(str, xx[0:]))))

+import sys + +input = sys.stdin.readline