N,Q=gets.split.map(&:to_i)
AB=(N-1).times.map{gets.split.map(&:to_i)}.sort_by{|a|a[0]}
PX=Q.times.map{gets.split.map(&:to_i)}

ans=Array.new(N,0)
PX.each do |p, x|
  ans[p-1] += x
end

AB.each do |a, b|
  ans[b-1] += ans[a-1]
end

puts ans.join(" ")