### BUGGY CODE ###

# -*- coding: utf-8 -*-

from collections import defaultdict, Counter, deque
from operator import itemgetter
import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def inpl(): return list(map(int, input().split()))

def eulartour(G):
    N = len(G)
    depth = [-1]*N
    depth[0] = 0
    eular = []
    L = [0]*N
    R = [0]*N
    i = 0
 
    def dfs(p):
        nonlocal depth, eular, i
        #eular.append(p)
        L[p] = i
        i += 1
        for q in G[p]:
            if depth[q] != -1:
                continue
            depth[q] = depth[p] + 1
            dfs(q)
        #eular.append(p)
        R[p] = i
        i += 1
    
    dfs(0)
    return L, R

class LazySegmentTree:
    
    def __init__(self, N, init_node=None, mode="max"):
        if mode == "sum":
            self.aggfunc = lambda x, y: x+y
            self.lazyaddfunc = lambda x, l, r: x*(r-l)
            self.lazyfunc = lambda x: x//2
        
        elif mode == "max":
            self.aggfunc = lambda x, y: x if x > y else y
            self.lazyaddfunc = lambda x, l, r: x
            self.lazyfunc = lambda x: x
        
        self.size = 2**int.bit_length(N)
        self.node = [0]*(2*self.size-1)
        if not init_node is None:
            for i in range(N):
                self.node[i+self.size-1] = init_node[i]
            for i in range(self.size-2, -1, -1):
                self.node[i] = self.aggfunc(self.node[2*i+1], self.node[2*i+2])
        self.lazy = [0]*(2*self.size-1)

    def eval(self, k, l, r):
        if self.lazy[k]:
            self.node[k] += self.lazy[k]
            if r-l-1:
                self.lazy[2*k+1] += self.lazyfunc(self.lazy[k])
                self.lazy[2*k+2] += self.lazyfunc(self.lazy[k])
            self.lazy[k] = 0

    def add(self, a, b, val):
        Q = [[0, 0, self.size]]
        Q2 = []

        def inner(k, l, r):
            nonlocal Q, Q2
            self.eval(k, l, r)
            if (b <= l) or (r <= a):
                return
            if (a<=l) and (r<=b):
                self.lazy[k] += self.lazyaddfunc(val, l, r)
                self.eval(k, l, r)
            else:
                Q.append([2*k+1, l, (l+r)//2])
                Q.append([2*k+2, (l+r)//2, r])
                Q2.append(k)

        while Q:
            inner(*Q.pop())
        
        while Q2:
            k = Q2.pop()
            self.node[k] = self.aggfunc(self.node[2*k+1], self.node[2*k+2])


    def getagg(self, a, b):
        ix = 0
        Q = [[0, 0, self.size, 0]]
        Q2 = []
        S = [0]

        def inner(k, l, r, i):
            nonlocal ix, Q, Q2, S
            if (b<=l) or (r <= a):
                return 0
            self.eval(k, l, r)
            if (a<=l) and (r<=b):
                S[i] = self.node[k]

            else:
                Q.append([2*k+1, l, (l+r)//2, ix+1])
                Q.append([2*k+2, (l+r)//2, r, ix+2])
                Q2.append([ix, ix+1, ix+2])
                S.extend([0, 0])
                ix += 2
        while Q:
            inner(*Q.pop())
        while Q2:
            x, y, z = Q2.pop()
            S[x] = self.aggfunc(S[y], S[z])
        return S[0]


N, Q = inpl()
G = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = inpl()
    G[a-1].append(b-1)
    G[b-1].append(a-1)

L, R = eulartour(G)

RSQ = LazySegmentTree(2*N)

for _ in range(Q):
    x, d = inpl()
    x -= 1
    RSQ.add(L[x], R[x]+1, d)
print(*[RSQ.getagg(L[i], L[i]+1) for i in range(N)])

### FIXED CODE ###

# -*- coding: utf-8 -*-

from collections import defaultdict, Counter, deque
from operator import itemgetter
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def inpl(): return list(map(int, input().split()))

N, Q = inpl()
G = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = inpl()
    G[a-1].append(b-1)
    G[b-1].append(a-1)

S = [0]*N
for _ in range(Q):
    x, d = inpl()
    S[x-1] += d

searched = [0]*N
searched[0] = True
Q = deque([0])

while Q:
    p = Q.popleft()
    for q in G[p]:
        if searched[q]:
            continue
        searched[q] = True
        S[q] += S[p]
        Q.append(q)

print(*S)