import sys
sys.setrecursionlimit(10**6)
def walk(n):
    global adj, point
    if len(adj[n])==0:
        return
    else:
        for a in adj[n]:
            point[a] += point[n]
        for a in adj[n]:
            walk(a)
N, Q = map(int, input().split())
adj = [[] for _ in range(N)]
point = [0 for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    adj[a-1].append(b-1)
for _ in range(Q):
    p, x = map(int, input().split())
    point[p-1] += x
walk(0)
print(" ".join(map(str, point)))