def dfs(p, x)
  @ans[p] += x
  @tree[p].each do |i|
    dfs(i, x)
  end
end

n, q = gets.split.map(&:to_i)
@tree = Array.new(n, [])
(n-1).times do
  a, b = gets.split.map(&:to_i)
  @tree[a-1] += [b-1]
end

# puts @tree.inspect

@ans = Array.new(n, 0)
q.times do
  p, x = gets.split.map(&:to_i)
  dfs(p-1, x)
end

puts @ans.join(" ")