import sys

sys.setrecursionlimit(10**6)



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



N,Q=MI()

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

Point=[0]*(N)

for _ in range(N-1):

  a,b=MI()

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

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

for _ in range(Q):

  p,x=MI()

  Point[p-1]+=x

  #print(p,Point[p-1])

  

def dfs(now,pre=-1):

  for nxt in Edge[now]:

    if nxt==pre:

      continue

    Point[nxt]+=Point[now]

    #print(*Point)

    dfs(nxt,now)

dfs(0)

print((*Point))
import collections

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

N,Q=MI()

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

Point=[0]*(N)

for _ in range(N-1):

  a,b=MI()

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

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

for _ in range(Q):

  p,x=MI()

  Point[p-1]+=x

check=[0]*N

que=collections.deque()

que.append(0)

while que:

  v=que.pop()

  check[v]=1

  for u in Edge[v]:

    if check[u]==1:

      continue    

    Point[u]+=Point[v]

    que.append(u)  

'''

def dfs(now,pre=-1):

  for nxt in Edge[now]:

    if nxt==pre:

      continue

    Point[nxt]+=Point[now]

    #print(*Point)

    dfs(nxt,now)

dfs(0)

'''

print((*Point))
import sys

sys.setrecursionlimit(10**6)


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


N, Q = MI()
Edge = [[] for _ in range(N)]
Point = [0] * (N)
for _ in range(N - 1):
    a, b = MI()
    Edge[a - 1].append(b - 1)
    Edge[b - 1].append(a - 1)
for _ in range(Q):
    p, x = MI()
    Point[p - 1] += x
    # print(p,Point[p-1])


def dfs(now, pre=-1):
    for nxt in Edge[now]:
        if nxt == pre:
            continue
        Point[nxt] += Point[now]
        # print(*Point)
        dfs(nxt, now)


dfs(0)
print((*Point))

import collections


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


N, Q = MI()
Edge = [[] for _ in range(N)]
Point = [0] * (N)
for _ in range(N - 1):
    a, b = MI()
    Edge[a - 1].append(b - 1)
    Edge[b - 1].append(a - 1)
for _ in range(Q):
    p, x = MI()
    Point[p - 1] += x
check = [0] * N
que = collections.deque()
que.append(0)
while que:
    v = que.pop()
    check[v] = 1
    for u in Edge[v]:
        if check[u] == 1:
            continue
        Point[u] += Point[v]
        que.append(u)
"""
def dfs(now,pre=-1):
  for nxt in Edge[now]:
    if nxt==pre:
      continue
    Point[nxt]+=Point[now]
    #print(*Point)
    dfs(nxt,now)
dfs(0)
"""
print((*Point))

-import sys - -sys.setrecursionlimit(10**6) +import collections -    # print(p,Point[p-1]) - - -def dfs(now, pre=-1): -    for nxt in Edge[now]: -        if nxt == pre: +check = [0] * N +que = collections.deque() +que.append(0) +while que: +    v = que.pop() +    check[v] = 1 +    for u in Edge[v]: +        if check[u] == 1: -        Point[nxt] += Point[now] -        # print(*Point) -        dfs(nxt, now) - - +        Point[u] += Point[v] +        que.append(u) +""" +def dfs(now,pre=-1): +  for nxt in Edge[now]: +    if nxt==pre: +      continue +    Point[nxt]+=Point[now] +    #print(*Point) +    dfs(nxt,now) +"""