n, q = gets.split(' ').map(&:to_i)

class Node
  attr_accessor :children, :targets, :parent
  def initialize()
    @children = []
    @targets = []
    @parent = -1
  end
end

$nodes = [nil]
$scores = [nil]
n.times do |i|
  node = Node.new()
  $nodes << node
  $scores << 0
end

(n-1).times do
  a, b = gets.split(' ').map(&:to_i)
  $nodes[a].children << b
  $nodes[a].targets << b
  $nodes[b].parent = a
  nn = $nodes[a]
  while nn.parent > 0 do
    $nodes[nn.parent].targets << b
    nn = $nodes[nn.parent]
  end
end

q.times do
  p, x = gets.split(' ').map(&:to_i)
  $scores[p] += x
  $nodes[p].targets.each do |i|
    $scores[i] += x
  end
end

puts $scores[1..-1].map(&:to_s).join(" ")
