@n, @q = gets.chomp.split.map(&:to_i)
@ab = {}
(@n-1).times do
  a, b = gets.chomp.split.map(&:to_i)
  @ab[b] = a
end
@qx = {}
@q.times do
  q, x = gets.chomp.split.map(&:to_i)
  if @qx.has_key?(q) then
    @qx[q] += x  
  else
    @qx[q] = x  
  end
end
#
@r = Array.new(@n)
@r[0] = (@qx.has_key?(1) ? @qx[1] : 0)
def calc(i)
  if @r[i-1] then
    return @r[i-1]
  end
  return @qx.has_key?(i) ? @qx[i] + calc(@ab[i]) : calc(@ab[i])
end
2.upto(@n) do |i|
  @r[i-1] = calc(i)
end
puts @r.map(&:to_s).join(" ")