Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i.  Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value 0.  Now, the following Q operations will be performed:    * Operation j (1 \leq j \leq Q): Increment by x_j the counter on every vertex contained in the subtree rooted at Vertex p_j.  Find the value of the counter on each vertex after all operations.
import numpy as np

import sys


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

T = [ [int(i) for i in input().split() ] for j in range(N - 1) ]

S = [ [int(i) for i in input().split() ] for j in range(Q) ]



w = []


# T = [[1,2],[2,3],[3,4],[3,5]]

T = np.array(T)



def return_number(n):
	
	x = []

	
	r = np.where(T[:,0] == n )

	for i in range(len(r[0])):
		x.append(T[r[0][i],1])
		

	return x	
	


def counter_children(y):
	counter = 0
	for i in range(len(y)):
		counter += len(return_number(y[i]))

	return counter	



def search_subtree(x,y):
	
	z = []

	
	
	if counter_children(y) == 0:
		return  x
	
	else:
		for i in range(len(y)):
			x += return_number(y[i]) 
			z += return_number(y[i]) 
		
		return search_subtree(x,z)

counter_node = [0 for i in range(N)]

for i in range(Q):
	
	
	 p = search_subtree([S[i][0]],[S[i][0]])

	 for j in range(len(p)):
	 	counter_node[p[j] - 1] += S[i][1]

for i in range(N):
	sys.stdout.write(str(counter_node[i]) + " ")

	 	


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
 
def dfs(v, p):
    for u in link[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
 
N, Q = map(int, input().split())
link = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)
 
ans = [0] * N
for i in range(Q):
    p, x = map(int, input().split())
    ans[p-1] += x
 
dfs(0, -1)
 
print(*ans)