#!/usr/bin/env python3
import sys
from collections import deque


def solve(N: int, Q: int, a: "List[int]", b: "List[int]", p: "List[int]", x: "List[int]"):

    edges = [[] for _ in range(N)]
    for ai, bi in zip(a,b):
        edges[ai-1].append(bi)
        edges[bi-1].append(ai)
    pls = [0]*N
    for pi, xi in zip(p, x):
        pls[pi-1]+=xi
    
    ans = [0]*N
    ans[0] = pls[0]
    q = deque([1])
    while q:
        temp = q.pop()
        for t in edges[temp-1]:
            edges[t-1].remove(temp)
            ans[t-1] = pls[t-1] + ans[temp-1]
        q.extend(edges[temp-1])

    print(*ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    p = [int()] * (Q)  # type: "List[int]"
    x = [int()] * (Q)  # type: "List[int]"
    for i in range(Q):
        p[i] = int(next(tokens))
        x[i] = int(next(tokens))
    solve(N, Q, a, b, p, x)

if __name__ == '__main__':
    main()
