# input
n, q = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(n-1)]
PX = [tuple(map(int, input().split())) for _ in range(q)]

# other_setting
child = [0] * n
parent = [0] * n
value = [0] * n

for i in range(n) : 
    child[i] = []

for a, b in AB : 
    child[a-1].append(b)
    parent[b-1] = a

# op_function
def op(a) : 
    if a != 1 : 
        value[a-1] += value[parent[a-1]-1]

    if child[a-1] != [] : 
        for c in child[a-1] : 
            op(c)
            
# initial_state(value)
for p, x in PX : 
    value[p-1] += x
    
# exe
op(1)

print(*value)