def main():

    import sys



    sys.setrecursionlimit(10 ** 7)



    input = sys.stdin.readline



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



    Graph = tuple(set() for _ in range(N))

    for _ in range(N - 1):

        a, b = (int(x) - 1 for x in input().split())

        Graph[a].add(b)

        Graph[b].add(a)



    ctr = [0] * N

    for _ in range(Q):

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

        p -= 1

        ctr[p] += x



    root = 0

    visited = [False] * N

    visited[root] = True



    def dfs(v):

        x = ctr[v]

        for u in Graph[v]:

            if visited[u]:

                continue

            visited[u] = True

            ctr[u] += x

            dfs(u)



    dfs(root)



    print((*ctr))





if __name__ == '__main__':

    main()



# import sys

#

# sys.setrecursionlimit(10 ** 7)

#

# input = sys.stdin.readline

# rstrip()

# int(input())

# map(int, input().split())

def main():

    from collections import deque

    import sys

    input = sys.stdin.readline



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



    Graph = tuple(set() for _ in range(N))

    for _ in range(N - 1):

        a, b = (int(x) - 1 for x in input().split())

        Graph[a].add(b)

        Graph[b].add(a)



    ctr = [0] * N

    for _ in range(Q):

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

        p -= 1

        ctr[p] += x



    root = 0

    visited = [False] * N

    visited[root] = True



    dq = deque()

    dq.append(root)



    while dq:

        v = dq.pop()

        x = ctr[v]

        for u in Graph[v]:

            if visited[u]:

                continue

            visited[u] = True

            ctr[u] += x

            dq.append(u)



    print((*ctr))





if __name__ == '__main__':

    main()

def main():
    import sys

    sys.setrecursionlimit(10**7)
    input = sys.stdin.readline
    N, Q = list(map(int, input().split()))
    Graph = tuple(set() for _ in range(N))
    for _ in range(N - 1):
        a, b = (int(x) - 1 for x in input().split())
        Graph[a].add(b)
        Graph[b].add(a)
    ctr = [0] * N
    for _ in range(Q):
        p, x = list(map(int, input().split()))
        p -= 1
        ctr[p] += x
    root = 0
    visited = [False] * N
    visited[root] = True

    def dfs(v):
        x = ctr[v]
        for u in Graph[v]:
            if visited[u]:
                continue
            visited[u] = True
            ctr[u] += x
            dfs(u)

    dfs(root)
    print((*ctr))


if __name__ == "__main__":
    main()
# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())

def main():
    from collections import deque
    import sys

    input = sys.stdin.readline
    N, Q = list(map(int, input().split()))
    Graph = tuple(set() for _ in range(N))
    for _ in range(N - 1):
        a, b = (int(x) - 1 for x in input().split())
        Graph[a].add(b)
        Graph[b].add(a)
    ctr = [0] * N
    for _ in range(Q):
        p, x = list(map(int, input().split()))
        p -= 1
        ctr[p] += x
    root = 0
    visited = [False] * N
    visited[root] = True
    dq = deque()
    dq.append(root)
    while dq:
        v = dq.pop()
        x = ctr[v]
        for u in Graph[v]:
            if visited[u]:
                continue
            visited[u] = True
            ctr[u] += x
            dq.append(u)
    print((*ctr))


if __name__ == "__main__":
    main()

+    from collections import deque -    sys.setrecursionlimit(10**7) - -    def dfs(v): +    dq = deque() +    dq.append(root) +    while dq: +        v = dq.pop() -            dfs(u) - -    dfs(root) +            dq.append(u) -# import sys -# -# sys.setrecursionlimit(10 ** 7) -# -# input = sys.stdin.readline -# rstrip() -# int(input()) -# map(int, input().split())