import sys
sys.setrecursionlimit(10**6)
 
def resolve():
    def dfs(num, p=-1):
        for i in to[num]:
            if p == i:
                continue
            ns[i] += ns[num]
            dfs(i, num)
 
    n, q = map(int, input().split())
 
    to = [[] for _ in range(n)]
 
    for _ in range(n-1):
        a,b = map(int, input().split())
        a -= 1
        b -= 1
        to[a].append(b)
        to[b].append(a)
 
    ns = [0 for _ in range(n)]
    for _ in range(q):
        p, x = map(int, input().split())
        p -= 1
        ns[p] += x
 
    dfs(0)
    print(*ns)
resolve()