def make_tree(i)
  @childs[i] << i
  @tree[i].each do |j|
    @tree[j] = @tree[j] - [i]
    @childs[i] += make_tree(j)
  end
  @childs[i]
end

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

@count = Array.new(@n + 1, 0)
@childs = Array.new(@n + 1){[]}
@tree = Array.new(@n + 1){[]}

(@n - 1).times do
  a, b = gets.chomp.split.map(&:to_i)
  @tree[a] << b
  @tree[b] << a
end

make_tree(1)

@q.times do
  pe, x = gets.chomp.split.map(&:to_i)
  @childs[pe].each do |i|
    @count[i] += x
  end
end

puts @count[1..@n] * ' '
