num_nodes, num_ops = gets.split(' ').map(&:to_i)
nodes = Array.new(num_nodes){ 0 }
paths = Array.new(num_nodes - 1){ gets.split(' ').map(&:to_i) }
 
num_ops.times do
  i, x = gets.split(' ').map(&:to_i)
  nodes[i-1] += x
end

bots = [[1,0]]
while bots.length > 0
  bots.map! do |(i,n)|
    nodes[i-1] += n
    n = nodes[i-1]
    children = paths.find_all{|p| p.include?(i) }
    paths -= children
    children.map{|p| [(p-[i])[0], n] }
  end
  bots.flatten!(1)
end

puts(nodes.join(' '))