class Node
  attr_accessor :val, :peer
  def initialize
    @peer = []
    @val = 0
  end
  def calc
    @peer.each do |p|
      p.val += @val
      p.peer.delete(self)
      p.calc
    end
  end
  def to_s
    @val.to_s
  end
end

n, q = ARGF.gets.split.map(&:to_i)
nodes = Array.new(n+1) { Node.new }

(n-1).times do
    a, b = ARGF.gets.split.map(&:to_i)
    nodes[a].peer << nodes[b]
    nodes[b].peer << nodes[a]
end
q.times do
    p, x = ARGF.gets.split.map(&:to_i)
    nodes[p].val += x
end

nodes[1].calc

nodes.shift
puts nodes.map(&:to_s).join(' ')
