import sys

stdin = sys.stdin



sys.setrecursionlimit(10 ** 7)



def li(): return list(map(int, stdin.readline().split()))

def li_(): return [int(x) - 1 for x in stdin.readline().split()]

def lf(): return list(map(float, stdin.readline().split()))

def ls(): return stdin.readline().split()

def ns(): return stdin.readline().rstrip()

def lc(): return list(ns())

def ni(): return int(stdin.readline())

def nf(): return float(stdin.readline())





n, q = li()

edge = [list(li_()) for _ in range(n-1)]

query = [list(li()) for _ in range(q)]



# 各頂点に指定の数字を入れる

num = [0]*n

for pi, xi in query:

    pi -= 1

    num[pi] += xi



# 木を構築

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

for ai, bi in edge:

    tree[ai].append(bi)

    tree[bi].append(ai)





# ルートから、親+自分の数字を入れる

visited = [False]*n

stack = [0]

visited[0] = True



while stack:

    cur = stack.pop()

    for nex in tree[cur]:

        if visited[nex]:

            continue



        visited[nex] = True

        num[nex] += num[cur]

        stack.append(nex)



# 出力

print((*num))

import sys

stdin = sys.stdin



sys.setrecursionlimit(10 ** 7)



def li(): return list(map(int, stdin.readline().split()))

def li_(): return [int(x) - 1 for x in stdin.readline().split()]

def lf(): return list(map(float, stdin.readline().split()))

def ls(): return stdin.readline().split()

def ns(): return stdin.readline().rstrip()

def lc(): return list(ns())

def ni(): return int(stdin.readline())

def nf(): return float(stdin.readline())



class Node(object):

    def __init__(self, num: int):

        self.num = num

        self.cnt = 0

        self.visited = False



def dfs(init_node: Node, graph: list):

    stack = [init_node]

    init_node.visited = True

    while stack:

        cur = stack.pop()

        for nex in graph[cur.num]:

            if nex.visited:

                cur.cnt += nex.cnt

                cur.visited = True

            else:

                stack.append(nex)



n, q = li()

nodes = [Node(i) for i in range(n)]

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



for _ in range(n-1):

    ai, bi = li_()

    graph[ai].append(nodes[bi])

    graph[bi].append(nodes[ai])



for _ in range(q):

    pi, xi = li()

    pi -= 1

    nodes[pi].cnt += xi



dfs(nodes[0], graph)



ans = [nodes[i].cnt for i in range(n)]

print((*ans))
import sys

stdin = sys.stdin
sys.setrecursionlimit(10**7)


def li():
    return list(map(int, stdin.readline().split()))


def li_():
    return [int(x) - 1 for x in stdin.readline().split()]


def lf():
    return list(map(float, stdin.readline().split()))


def ls():
    return stdin.readline().split()


def ns():
    return stdin.readline().rstrip()


def lc():
    return list(ns())


def ni():
    return int(stdin.readline())


def nf():
    return float(stdin.readline())


n, q = li()
edge = [list(li_()) for _ in range(n - 1)]
query = [list(li()) for _ in range(q)]
# 各頂点に指定の数字を入れる
num = [0] * n
for pi, xi in query:
    pi -= 1
    num[pi] += xi
# 木を構築
tree = [[] for _ in range(n)]
for ai, bi in edge:
    tree[ai].append(bi)
    tree[bi].append(ai)
# ルートから、親+自分の数字を入れる
visited = [False] * n
stack = [0]
visited[0] = True
while stack:
    cur = stack.pop()
    for nex in tree[cur]:
        if visited[nex]:
            continue
        visited[nex] = True
        num[nex] += num[cur]
        stack.append(nex)
# 出力
print((*num))

import sys

stdin = sys.stdin
sys.setrecursionlimit(10**7)


def li():
    return list(map(int, stdin.readline().split()))


def li_():
    return [int(x) - 1 for x in stdin.readline().split()]


def lf():
    return list(map(float, stdin.readline().split()))


def ls():
    return stdin.readline().split()


def ns():
    return stdin.readline().rstrip()


def lc():
    return list(ns())


def ni():
    return int(stdin.readline())


def nf():
    return float(stdin.readline())


class Node(object):
    def __init__(self, num: int):
        self.num = num
        self.cnt = 0
        self.visited = False


def dfs(init_node: Node, graph: list):
    stack = [init_node]
    init_node.visited = True
    while stack:
        cur = stack.pop()
        for nex in graph[cur.num]:
            if nex.visited:
                cur.cnt += nex.cnt
                cur.visited = True
            else:
                stack.append(nex)


n, q = li()
nodes = [Node(i) for i in range(n)]
graph = [[] for _ in range(n)]
for _ in range(n - 1):
    ai, bi = li_()
    graph[ai].append(nodes[bi])
    graph[bi].append(nodes[ai])
for _ in range(q):
    pi, xi = li()
    pi -= 1
    nodes[pi].cnt += xi
dfs(nodes[0], graph)
ans = [nodes[i].cnt for i in range(n)]
print((*ans))

+class Node(object): +    def __init__(self, num: int): +        self.num = num +        self.cnt = 0 +        self.visited = False + + +def dfs(init_node: Node, graph: list): +    stack = [init_node] +    init_node.visited = True +    while stack: +        cur = stack.pop() +        for nex in graph[cur.num]: +            if nex.visited: +                cur.cnt += nex.cnt +                cur.visited = True +            else: +                stack.append(nex) + + -edge = [list(li_()) for _ in range(n - 1)] -query = [list(li()) for _ in range(q)] -# 各頂点に指定の数字を入れる -num = [0] * n -for pi, xi in query: +nodes = [Node(i) for i in range(n)] +graph = [[] for _ in range(n)] +for _ in range(n - 1): +    ai, bi = li_() +    graph[ai].append(nodes[bi]) +    graph[bi].append(nodes[ai]) +for _ in range(q): +    pi, xi = li() -    num[pi] += xi -# 木を構築 -tree = [[] for _ in range(n)] -for ai, bi in edge: -    tree[ai].append(bi) -    tree[bi].append(ai) -# ルートから、親+自分の数字を入れる -visited = [False] * n -stack = [0] -visited[0] = True -while stack: -    cur = stack.pop() -    for nex in tree[cur]: -        if visited[nex]: -            continue -        visited[nex] = True -        num[nex] += num[cur] -        stack.append(nex) -# 出力 -print((*num)) +    nodes[pi].cnt += xi +dfs(nodes[0], graph) +ans = [nodes[i].cnt for i in range(n)] +print((*ans))