def slove():

    import sys

    import collections

    input = sys.stdin.readline

    n, q = list(map(int, input().rstrip('\n').split()))

    d = collections.defaultdict(list)

    for i in range(n-1):

        a, b = list(map(int, input().rstrip('\n').split()))

        d[a] += [b]

        d[b] += [a]



    score = collections.defaultdict(int)

    for i in range(q):

        p, x = list(map(int, input().rstrip('\n').split()))

        score[p] += x



    ql = collections.deque()

    ql.append(1)

    fq = collections.defaultdict(list)

    fq[1]

    while True:

        if len(ql) != 0:

            p = ql.popleft()

            for v in d[p]:

                if v not in fq:

                    score[v] += score[p]

                    fq[v]

                    ql.append(v)

        else:

            break

    print((*[score[i] for i in range(1, n + 1)]))





if __name__ == '__main__':

    slove()

import sys

import collections





def solve():

    input = sys.stdin.readline

    mod = 10 ** 9 + 7

    n, q = list(map(int, input().rstrip('\n').split()))

    d = collections.defaultdict(list)

    for i in range(n-1):

        a, b = list(map(int, input().rstrip('\n').split()))

        d[a-1] += [b-1]

        d[b-1] += [a-1]

    ls = [0] * n

    for i in range(q):

        p, x = list(map(int, input().rstrip('\n').split()))

        ls[p-1] += x

    ql = collections.deque([0])

    fq = collections.defaultdict(int)

    fq[0]

    while True:

        if len(ql) != 0:

            p = ql.popleft()

            for v in d[p]:

                if v not in fq:

                    ls[v] += ls[p]

                    ql.appendleft(v)

                    fq[p]

        else:

            print((*ls))

            exit()





if __name__ == '__main__':

    solve()

def slove():
    import sys
    import collections

    input = sys.stdin.readline
    n, q = list(map(int, input().rstrip("\n").split()))
    d = collections.defaultdict(list)
    for i in range(n - 1):
        a, b = list(map(int, input().rstrip("\n").split()))
        d[a] += [b]
        d[b] += [a]
    score = collections.defaultdict(int)
    for i in range(q):
        p, x = list(map(int, input().rstrip("\n").split()))
        score[p] += x
    ql = collections.deque()
    ql.append(1)
    fq = collections.defaultdict(list)
    fq[1]
    while True:
        if len(ql) != 0:
            p = ql.popleft()
            for v in d[p]:
                if v not in fq:
                    score[v] += score[p]
                    fq[v]
                    ql.append(v)
        else:
            break
    print((*[score[i] for i in range(1, n + 1)]))


if __name__ == "__main__":
    slove()

import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10**9 + 7
    n, q = list(map(int, input().rstrip("\n").split()))
    d = collections.defaultdict(list)
    for i in range(n - 1):
        a, b = list(map(int, input().rstrip("\n").split()))
        d[a - 1] += [b - 1]
        d[b - 1] += [a - 1]
    ls = [0] * n
    for i in range(q):
        p, x = list(map(int, input().rstrip("\n").split()))
        ls[p - 1] += x
    ql = collections.deque([0])
    fq = collections.defaultdict(int)
    fq[0]
    while True:
        if len(ql) != 0:
            p = ql.popleft()
            for v in d[p]:
                if v not in fq:
                    ls[v] += ls[p]
                    ql.appendleft(v)
                    fq[p]
        else:
            print((*ls))
            exit()


if __name__ == "__main__":
    solve()

-def slove(): -    import sys -    import collections +import sys +import collections + +def solve(): +    mod = 10**9 + 7 -        d[a] += [b] -        d[b] += [a] -    score = collections.defaultdict(int) +        d[a - 1] += [b - 1] +        d[b - 1] += [a - 1] +    ls = [0] * n -        score[p] += x -    ql = collections.deque() -    ql.append(1) -    fq = collections.defaultdict(list) -    fq[1] +        ls[p - 1] += x +    ql = collections.deque([0]) +    fq = collections.defaultdict(int) +    fq[0] -                    score[v] += score[p] -                    fq[v] -                    ql.append(v) +                    ls[v] += ls[p] +                    ql.appendleft(v) +                    fq[p] -            break -    print((*[score[i] for i in range(1, n + 1)])) +            print((*ls)) +            exit() -    slove() +    solve()