class Node
  attr_reader :children, :value
  def initialize(id)
    @id = id
    @children = []
    @value = 0
  end

  def add_value(v)
    @value += v
    @children.each do |c|
      c.add_value(v)
    end
  end
end

n, q = gets.split.map(&:to_i)
nodes = n.times.map{|i|Node.new(i+1)}
(n-1).times do
  a, b = gets.split.map(&:to_i)
  nodes[a-1].children << nodes[b-1]
end

q.times do
  p, x = gets.split.map(&:to_i)
  nodes[p-1].add_value(x)
end

puts nodes.map(&:value).join(' ')
