import sys

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

input=lambda :sys.stdin.readline().rstrip()

def resolve():

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

    E=[[] for _ in range(n)]

    for _ in range(n-1):

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

        a-=1; b-=1

        E[a].append(b)

        E[b].append(a)

    ans=[0]*n

    for _ in range(q):

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

        p-=1

        ans[p]+=x



    def dfs(v,p=-1):

        for u in E[v]:

            if u==p: continue

            ans[u]+=ans[v]

            dfs(u,v)



    dfs(0)

    print((*ans))



resolve()
import sys

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

input=lambda:sys.stdin.readline().rstrip()

def resolve():

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

    E=[[] for _ in range(n)]

    for _ in range(n-1):

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

        a-=1; b-=1

        E[a].append(b)

        E[b].append(a)



    C=[0]*n

    for _ in range(q):

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

        p-=1

        C[p]+=x



    Q=[(0,-1)]

    while(Q):

        v,p=Q.pop()

        for nv in E[v]:

            if(p==nv): continue

            C[nv]+=C[v]

            Q.append((nv,v))



    print((*C))

resolve()
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    n, q = list(map(int, input().split()))
    E = [[] for _ in range(n)]
    for _ in range(n - 1):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        E[a].append(b)
        E[b].append(a)
    ans = [0] * n
    for _ in range(q):
        p, x = list(map(int, input().split()))
        p -= 1
        ans[p] += x

    def dfs(v, p=-1):
        for u in E[v]:
            if u == p:
                continue
            ans[u] += ans[v]
            dfs(u, v)

    dfs(0)
    print((*ans))


resolve()

import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    n, q = list(map(int, input().split()))
    E = [[] for _ in range(n)]
    for _ in range(n - 1):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        E[a].append(b)
        E[b].append(a)
    C = [0] * n
    for _ in range(q):
        p, x = list(map(int, input().split()))
        p -= 1
        C[p] += x
    Q = [(0, -1)]
    while Q:
        v, p = Q.pop()
        for nv in E[v]:
            if p == nv:
                continue
            C[nv] += C[v]
            Q.append((nv, v))
    print((*C))


resolve()

-    ans = [0] * n +    C = [0] * n -        ans[p] += x - -    def dfs(v, p=-1): -        for u in E[v]: -            if u == p: +        C[p] += x +    Q = [(0, -1)] +    while Q: +        v, p = Q.pop() +        for nv in E[v]: +            if p == nv: -            ans[u] += ans[v] -            dfs(u, v) - -    dfs(0) -    print((*ans)) +            C[nv] += C[v] +            Q.append((nv, v)) +    print((*C))