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

# key: root, value: set(children)
hash = {}

(n-1).times do |t|
  a,b = gets.chomp.split(" ").map(&:to_i)
  hash[a] ||= []
  hash[a] << b
end

result = []
q.times do |t|
  q,x = gets.chomp.split(" ").map(&:to_i)
  arr = [q]
  while arr.length > 0 do
    a = arr.shift
    result[a-1] ||= 0
    result[a-1] += x
    children = hash[a] || []
    arr += children
  end
end

puts result.join(" ")

