import numpy as np
n,q= map(int,input().split())

edges = {i+1:[] for i in range(n+1)}
for i in range(n-1):
  a,b = map(int,input().split())
  edges[a].append(b)

ans = np.zeros(n)
dp = {i:np.zeros(n) for i in range(1,n+1)}
for i in range(1,n+1):
  dp[i][i-1] = 1
for i in range(n,0,-1):
  for j in edges[i]:
    dp[i] += dp[j]

queries = [0]*(n+1)
for _ in range(q):
  p,x = map(int,input().split())
  queries[p] += x
for i in range(1,n+1):
  ans += queries[i]*dp[i]
    
st = ""
for i in range(n):
  if i != 0:
    st+=" "
  st+= str(int(ans[i]))
print(st)