io = STDIN
N,Q=io.gets.split.map(&:to_i)
ab=Hash.new{|h,k|h[k]=[]}
ar=Array.new(N+1,0)
(N-1).times do
  a,b = io.gets.split.map(&:to_i)
  ab[a-1] << b-1
end
Q.times do
  p,x=io.gets.split.map(&:to_i)
  ar[p-1]+=x
end
(0...N).each do |n|
  ab[n].each do |to|
    ar[to]+=ar[n]
  end
end
puts ar[0..-2].join(" ")
