n,q = gets.chomp.split(" ").map(&:to_i)
adjacent = Array.new(n+1){Array.new}
value = Array.new(n+1,0)
adjacent[1] << 0
(n-1).times do
  i,j = gets.chomp.split(" ").map(&:to_i)
  adjacent[j] << i
  adjacent[i] << j
end
q.times do
  i,j = gets.chomp.split(" ").map(&:to_i)
  value[i] += j
end
depth = [1]
checked = Array.new(n+1,false)
checked[0] = true
while(child = depth.shift)
  checked[child] = true
  adjacent[child].each do |node|
    unless checked[node]
      depth << node
    end
  end
  value[child] += value[adjacent[child].find{|e| checked[e]}]
end
puts value[1..n].join(" ")
