from collections import deque

def submit():

  n,q = map(int,input().split())

  y = [[] for _ in range(n)]

  c = [0]*n

  for _ in range(n-1):

    ai,bi = map(int,input().split())

    y[ai-1].append(bi-1)

    y[bi-1].append(ai-1)

  for _ in range(q):

    pi,xi = map(int,input().split())

    c[pi-1] += xi

  z = deque([[0,-1]])

  while z:

    j,b = z.popleft()

    for yj in y[j]:

      if yj != b:

        z.append([yj,j])

        c[yj] += c[j]

  for i in range(n):

    print(c[i],end=" ")

submit()

def submit():

  from collections import deque

  import sys

  input = sys.stdin.readline

  n,q = map(int,input().split())

  y = [[] for _ in range(n)]

  c = [0]*n

  for _ in range(n-1):

    ai,bi = map(int,input().split())

    y[ai-1].append(bi-1)

    y[bi-1].append(ai-1)

  for _ in range(q):

    pi,xi = map(int,input().split())

    c[pi-1] += xi

  z = deque([[0,-1]])

  while z:

    j,b = z.popleft()

    for yj in y[j]:

      if yj != b:

        z.append([yj,j])

        c[yj] += c[j]

  for i in range(n):

    print(c[i],end=" ")

submit()

from collections import deque


def submit():
    n, q = map(int, input().split())
    y = [[] for _ in range(n)]
    c = [0] * n
    for _ in range(n - 1):
        ai, bi = map(int, input().split())
        y[ai - 1].append(bi - 1)
        y[bi - 1].append(ai - 1)
    for _ in range(q):
        pi, xi = map(int, input().split())
        c[pi - 1] += xi
    z = deque([[0, -1]])
    while z:
        j, b = z.popleft()
        for yj in y[j]:
            if yj != b:
                z.append([yj, j])
                c[yj] += c[j]
    for i in range(n):
        print(c[i], end=" ")


submit()

def submit():
    from collections import deque
    import sys

    input = sys.stdin.readline
    n, q = map(int, input().split())
    y = [[] for _ in range(n)]
    c = [0] * n
    for _ in range(n - 1):
        ai, bi = map(int, input().split())
        y[ai - 1].append(bi - 1)
        y[bi - 1].append(ai - 1)
    for _ in range(q):
        pi, xi = map(int, input().split())
        c[pi - 1] += xi
    z = deque([[0, -1]])
    while z:
        j, b = z.popleft()
        for yj in y[j]:
            if yj != b:
                z.append([yj, j])
                c[yj] += c[j]
    for i in range(n):
        print(c[i], end=" ")


submit()

-from collections import deque +def submit(): +    from collections import deque +    import sys - -def submit(): +    input = sys.stdin.readline