from collections import deque





def main():

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

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

    ops = []

    ans = [0] * N

    

    for _ in range(N - 1):

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

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

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

    for _ in range(Q):

        ops.append(tuple(map(int, input().split())))

    

    for op in ops:

        node = op[0] - 1

        pnt = op[1]

        ans[node] += pnt

    

    stack = deque()

    stack.append((0, -1))

    

    while stack:

        st = stack.pop()

        node, parent = st[0], st[1]

        children = edge[node]

        for child in children:

            if child == parent:

                continue

            ans[child] += ans[node]

            stack.append((child, node))

    

    print((*ans))





if __name__ == '__main__':

    main()

import sys

from collections import deque

sys.setrecursionlimit(10 ** 5)

input = sys.stdin.readline





def main():

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

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

    ops = []

    ans = [0] * N



    for _ in range(N - 1):

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

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

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

    for _ in range(Q):

        ops.append(tuple(map(int, input().split())))



    for op in ops:

        node = op[0] - 1

        pnt = op[1]

        ans[node] += pnt



    stack = deque()

    stack.append((0, -1))



    while stack:

        st = stack.pop()

        node, parent = st[0], st[1]

        children = edge[node]

        for child in children:

            if child == parent:

                continue

            ans[child] += ans[node]

            stack.append((child, node))



    print((*ans))





if __name__ == '__main__':

    main()

from collections import deque


def main():
    N, Q = list(map(int, input().split()))
    edge = [[] for i in range(N)]
    ops = []
    ans = [0] * N
    for _ in range(N - 1):
        a, b = list(map(int, input().split()))
        edge[a - 1].append(b - 1)
        edge[b - 1].append(a - 1)
    for _ in range(Q):
        ops.append(tuple(map(int, input().split())))
    for op in ops:
        node = op[0] - 1
        pnt = op[1]
        ans[node] += pnt
    stack = deque()
    stack.append((0, -1))
    while stack:
        st = stack.pop()
        node, parent = st[0], st[1]
        children = edge[node]
        for child in children:
            if child == parent:
                continue
            ans[child] += ans[node]
            stack.append((child, node))
    print((*ans))


if __name__ == "__main__":
    main()

import sys
from collections import deque

sys.setrecursionlimit(10**5)
input = sys.stdin.readline


def main():
    N, Q = list(map(int, input().split()))
    edge = [[] for i in range(N)]
    ops = []
    ans = [0] * N
    for _ in range(N - 1):
        a, b = list(map(int, input().split()))
        edge[a - 1].append(b - 1)
        edge[b - 1].append(a - 1)
    for _ in range(Q):
        ops.append(tuple(map(int, input().split())))
    for op in ops:
        node = op[0] - 1
        pnt = op[1]
        ans[node] += pnt
    stack = deque()
    stack.append((0, -1))
    while stack:
        st = stack.pop()
        node, parent = st[0], st[1]
        children = edge[node]
        for child in children:
            if child == parent:
                continue
            ans[child] += ans[node]
            stack.append((child, node))
    print((*ans))


if __name__ == "__main__":
    main()

+import sys + +sys.setrecursionlimit(10**5) +input = sys.stdin.readline