N, Q = gets.split.map(&:to_i)
nodes = Hash.new
counter = Hash.new(0)
(N-1).times do
  a, b = gets.split.map(&:to_i)
  nodes[b] = a
end
Q.times do
  n, c = gets.split.map(&:to_i)
  counter[n] += c
end
result = [0]
1.upto(N) do |i|
  result << if nodes[i]
    counter[i] + result[nodes[i]]
  else
    counter[i]
  end
end
result.shift
puts result.join(' ')
