import sys

sys.setrecursionlimit(10**7)



def main():

    N, Q = [int(i) for i in input().split()]

    V = [set() for _ in range(N)]

    for _ in range(N - 1):

        a, b = [int(i) - 1 for i in input().split()]

        V[a].add(b)

        V[b].add(a)

    C = [0] * N

    for _ in range(Q):

        p, x = [int(i) for i in input().split()]

        C[p - 1] += x

    cur = [(0, 0)]

    while cur:

        nxt = []

        for n, x in cur:

            C[n] = x = C[n] + x

            for c in V[n]:

                V[c].remove(n)

                nxt.append((c, x))

        cur = nxt

    print((' '.join(str(c) for c in C)))



main()

def main():

    N, Q = [int(i) for i in input().split()]

    V = [set() for _ in range(N)]

    for _ in range(N - 1):

        a, b = [int(i) - 1 for i in input().split()]

        V[a].add(b)

        V[b].add(a)

    C = [0] * N

    for _ in range(Q):

        p, x = [int(i) for i in input().split()]

        C[p - 1] += x

    cur = [(0, 0)]

    while cur:

        n, x = cur.pop()

        C[n] = x = C[n] + x

        for c in V[n]:

            V[c].remove(n)

            cur.append((c, x))

    print((' '.join(str(c) for c in C)))



main()

import sys

sys.setrecursionlimit(10**7)


def main():
    N, Q = [int(i) for i in input().split()]
    V = [set() for _ in range(N)]
    for _ in range(N - 1):
        a, b = [int(i) - 1 for i in input().split()]
        V[a].add(b)
        V[b].add(a)
    C = [0] * N
    for _ in range(Q):
        p, x = [int(i) for i in input().split()]
        C[p - 1] += x
    cur = [(0, 0)]
    while cur:
        nxt = []
        for n, x in cur:
            C[n] = x = C[n] + x
            for c in V[n]:
                V[c].remove(n)
                nxt.append((c, x))
        cur = nxt
    print((" ".join(str(c) for c in C)))


main()

def main():
    N, Q = [int(i) for i in input().split()]
    V = [set() for _ in range(N)]
    for _ in range(N - 1):
        a, b = [int(i) - 1 for i in input().split()]
        V[a].add(b)
        V[b].add(a)
    C = [0] * N
    for _ in range(Q):
        p, x = [int(i) for i in input().split()]
        C[p - 1] += x
    cur = [(0, 0)]
    while cur:
        n, x = cur.pop()
        C[n] = x = C[n] + x
        for c in V[n]:
            V[c].remove(n)
            cur.append((c, x))
    print((" ".join(str(c) for c in C)))


main()

-import sys - -sys.setrecursionlimit(10**7) - - -        nxt = [] -        for n, x in cur: -            C[n] = x = C[n] + x -            for c in V[n]: -                V[c].remove(n) -                nxt.append((c, x)) -        cur = nxt +        n, x = cur.pop() +        C[n] = x = C[n] + x +        for c in V[n]: +            V[c].remove(n) +            cur.append((c, x))