from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

import sys,bisect,math,itertools,pprint,fractions

sys.setrecursionlimit(10**8)

mod = 10**9+7

mod2 = 998244353

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))



n,q = inpl()

g = [[]for i in range(n)]

c = [0 for i in range(n)]

seen = [False] * n

for i in range(n-1):

    a,b = inpl()

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

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

for i in range(q):

    a,b = inpl()

    c[a-1] += b

def dfs(node):

    for v in g[node]:

        if seen[v]:

            continue

        c[v] += c[node]

        seen[v] = True

        dfs(v) 

seen[0] = True

dfs(0)

for i in c:

    print(i)
from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

import sys,bisect,math,itertools,fractions,pprint

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))



n,q = inpl()

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

for i in range(n-1):

    a,b = inpl()

    a -= 1; b -= 1

    g[a].append(b)

    g[b].append(a)

c = [0] * n

for i in range(q):

    a,b = inpl()

    c[a-1] += b

q = deque()

q.append(0)

fin = [False] * n

fin[0] = True

while q:

    v = q.popleft()

    for nv in g[v]:

        if fin[nv]:continue

        c[nv] += c[v]

        fin[nv] = True

        q.append(nv)

print((*c))
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, pprint, fractions

sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))


n, q = inpl()
g = [[] for i in range(n)]
c = [0 for i in range(n)]
seen = [False] * n
for i in range(n - 1):
    a, b = inpl()
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
for i in range(q):
    a, b = inpl()
    c[a - 1] += b


def dfs(node):
    for v in g[node]:
        if seen[v]:
            continue
        c[v] += c[node]
        seen[v] = True
        dfs(v)


seen[0] = True
dfs(0)
for i in c:
    print(i)

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint

sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


n, q = inpl()
g = [[] for _ in range(n)]
for i in range(n - 1):
    a, b = inpl()
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
c = [0] * n
for i in range(q):
    a, b = inpl()
    c[a - 1] += b
q = deque()
q.append(0)
fin = [False] * n
fin[0] = True
while q:
    v = q.popleft()
    for nv in g[v]:
        if fin[nv]:
            continue
        c[nv] += c[v]
        fin[nv] = True
        q.append(nv)
print((*c))

-import sys, bisect, math, itertools, pprint, fractions +import sys, bisect, math, itertools, fractions, pprint -mod2 = 998244353 -def inpln(n): -    return list(int(sys.stdin.readline()) for i in range(n)) - - -g = [[] for i in range(n)] -c = [0 for i in range(n)] -seen = [False] * n +g = [[] for _ in range(n)] -    g[a - 1].append(b - 1) -    g[b - 1].append(a - 1) +    a -= 1 +    b -= 1 +    g[a].append(b) +    g[b].append(a) +c = [0] * n - - -def dfs(node): -    for v in g[node]: -        if seen[v]: +q = deque() +q.append(0) +fin = [False] * n +fin[0] = True +while q: +    v = q.popleft() +    for nv in g[v]: +        if fin[nv]: -        c[v] += c[node] -        seen[v] = True -        dfs(v) - - -seen[0] = True -dfs(0) -for i in c: -    print(i) +        c[nv] += c[v] +        fin[nv] = True +        q.append(nv) +print((*c))