from collections import deque
import sys
def main():
  a,b=map(int,sys.stdin.readline().split())
  e=[[]for i in range(a)]

  for i in range(a-1):
    c1,c2=map(int,sys.stdin.readline().split())
    e[c1-1].append(c2-1)
    e[c2-1].append(c1-1)

  g=[[]for i in range(a)]
  f=deque([(0,-1)])
  ans=[0 for _ in range(a)]
  for i in range(b):
    ten,p=map(int,input().split())
    ans[ten-1]+=p
  i=0
  while len(f)!=0:
    i,fr=f.pop()
    for j in e[i]:
      if j==fr:
        continue
      else:
        ans[j]+=ans[i]
        f.append((j,i)) 
  print(*ans)
if __name__ == '__main__':  
  main()
    
  

  
  
