n, q = gets.split.map(&:to_i)
edges = Array.new(n) { Array.new }
additions = Array.new(n, 0)
answers = Array.new(n, 0)
(n - 1).times {
  a, b = gets.split.map(&:to_i).map(&:pred)
  edges[a] << b
}
q.times {
  spot, count = gets.split.map(&:to_i)
  additions[spot - 1] += count
}

# 現在地、累計ポイント
queue = [[0, additions.first]]

until queue.empty?
  current, point = queue.shift
  if edges[current].empty?
    answers[current] = point
  else
    answers[current] = point
    edges[current].each do |edge|
      queue << [edge, point + additions[edge]]
    end
  end
end

puts answers.join(" ")
