io = STDIN
N,Q=io.gets.split.map(&:to_i)
tree=Hash.new{|h,k|h[k]=[]}
score=Array.new(N,0)
visited=Array.new(N,false)
(N-1).times do
  a,b = io.gets.split.map(&:to_i)
  tree[a.pred] << b.pred
  tree[b.pred] << a.pred
end
Q.times do
  p,x=io.gets.split.map(&:to_i)
  score[p.pred]+=x
end
que=[0]
while n=que.shift
  visited[n]=true
  tree[n].each do |to|
    next if visited[to]
    score[to]+=score[n]
    que << to
  end
end
puts score.join(" ")
