n, q = gets.split.map(&:to_i)
nums = Array.new(n){|i| i = []}
(n-1).times{
  a, b = gets.split.map(&:to_i)
  nums[a-1] << b-1
  nums[b-1] << a-1
}
opn = Array.new(n){|i| i = 0}
q.times{
  p, x = gets.split.map(&:to_i)
  opn[p-1] += x
}

stack = [0]
check = Array.new(n){|i| i = 0}

while stack.count > 0
  e = stack.pop
  if check[e] == 1
    next
  end
  check[e] += 1
  nums[e].each do |i|
    if check[i] == 1
      opn[e] += opn[i]
    else
      stack.push(i)
    end
  end
end
puts opn.join(" ")