#import pysnooper

#import os,re,sys,operator,math,heapq,string

#from collections import Counter,deque

#from operator import itemgetter

#from itertools import accumulate,combinations,groupby

from sys import stdin,setrecursionlimit

#from copy import deepcopy



setrecursionlimit(10**6)



def rec(pp,xx=-1):

    for i in gragh[pp]:

        if i==xx:

            continue

        ans[i]+=ans[pp]

        rec(i,pp)



n,q=list(map(int,stdin.readline().rstrip().split()))

ans=[0]*n

gragh=[[]*n for _ in range(n)]

for _ in range(n-1):

    a,b=list(map(int,stdin.readline().rstrip().split()))

    a-=1

    b-=1



    gragh[a].append(b)

    gragh[b].append(a)

for _ in range(q):

    p,x=list(map(int,stdin.readline().rstrip().split()))

    ans[p-1]+=x

rec(0)

print((*ans))

#import pysnooper

#import os,re,sys,operator,math,heapq,string

#from collections import Counter,deque

#from operator import itemgetter

#from itertools import accumulate,combinations,groupby,combinations_with_replacement

from sys import stdin,setrecursionlimit

#from copy import deepcopy



setrecursionlimit(10**6)

input=stdin.readline



def dfs(v,c=-1):

    for i in graph[v]:

        if i==c:

            continue

        root[i]+=root[v]

        dfs(i,v)

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

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

root=[0]*n

for i in range(n-1):

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

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

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



for i in range(q):

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

    root[p-1]+=x

dfs(0)

print((*root))
# import pysnooper
# import os,re,sys,operator,math,heapq,string
# from collections import Counter,deque
# from operator import itemgetter
# from itertools import accumulate,combinations,groupby
from sys import stdin, setrecursionlimit

# from copy import deepcopy
setrecursionlimit(10**6)


def rec(pp, xx=-1):
    for i in gragh[pp]:
        if i == xx:
            continue
        ans[i] += ans[pp]
        rec(i, pp)


n, q = list(map(int, stdin.readline().rstrip().split()))
ans = [0] * n
gragh = [[] * n for _ in range(n)]
for _ in range(n - 1):
    a, b = list(map(int, stdin.readline().rstrip().split()))
    a -= 1
    b -= 1
    gragh[a].append(b)
    gragh[b].append(a)
for _ in range(q):
    p, x = list(map(int, stdin.readline().rstrip().split()))
    ans[p - 1] += x
rec(0)
print((*ans))

# import pysnooper
# import os,re,sys,operator,math,heapq,string
# from collections import Counter,deque
# from operator import itemgetter
# from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin, setrecursionlimit

# from copy import deepcopy
setrecursionlimit(10**6)
input = stdin.readline


def dfs(v, c=-1):
    for i in graph[v]:
        if i == c:
            continue
        root[i] += root[v]
        dfs(i, v)


n, q = list(map(int, input().split()))
graph = [[] for _ in range(n)]
root = [0] * n
for i in range(n - 1):
    a, b = list(map(int, input().split()))
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
for i in range(q):
    p, x = list(map(int, input().split()))
    root[p - 1] += x
dfs(0)
print((*root))

-# from itertools import accumulate,combinations,groupby +# from itertools import accumulate,combinations,groupby,combinations_with_replacement +input = stdin.readline -def rec(pp, xx=-1): -    for i in gragh[pp]: -        if i == xx: +def dfs(v, c=-1): +    for i in graph[v]: +        if i == c: -        ans[i] += ans[pp] -        rec(i, pp) +        root[i] += root[v] +        dfs(i, v) -n, q = list(map(int, stdin.readline().rstrip().split())) -ans = [0] * n -gragh = [[] * n for _ in range(n)] -for _ in range(n - 1): -    a, b = list(map(int, stdin.readline().rstrip().split())) -    a -= 1 -    b -= 1 -    gragh[a].append(b) -    gragh[b].append(a) -for _ in range(q): -    p, x = list(map(int, stdin.readline().rstrip().split())) -    ans[p - 1] += x -rec(0) -print((*ans)) +n, q = list(map(int, input().split())) +graph = [[] for _ in range(n)] +root = [0] * n +for i in range(n - 1): +    a, b = list(map(int, input().split())) +    graph[a - 1].append(b - 1) +    graph[b - 1].append(a - 1) +for i in range(q): +    p, x = list(map(int, input().split())) +    root[p - 1] += x +dfs(0) +print((*root))