def main():

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

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

    for _ in range(N - 1):

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

        V[a].append(b)

        V[b].append(a)

    C = [0] * N

    for _ in range(Q):

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

        C[p - 1] += x

    cur = [(0, 0, -1)]

    while cur:

        n, x, f = cur.pop()

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

        for c in V[n]:

            if c != f:

                cur.append((c, x, n))

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



main()

def main():

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

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

    for _ in range(N - 1):

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

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

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

    C = [0] * N

    for _ in range(Q):

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

        C[p - 1] += x

    cur = [(0, 0, -1)]

    while cur:

        n, x, f = cur.pop()

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

        for c in V[n]:

            if c != f:

                cur.append((c, x, n))

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



main()

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


main()

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


main()

-    N, Q = [int(i) for i in input().split()] +    N, Q = list(map(int, input().split())) -        a, b = [int(i) - 1 for i in input().split()] -        V[a].append(b) -        V[b].append(a) +        a, b = list(map(int, input().split())) +        V[a - 1].append(b - 1) +        V[b - 1].append(a - 1) -        p, x = [int(i) for i in input().split()] +        p, x = list(map(int, input().split()))