n , q = gets.split.map(&:to_i)
ary = []
(n-1).times do
  a , b = gets.split.map(&:to_i)
  ary[a] ||= []
  ary[b] ||= []
  ary[a].push(b)
  ary[b].push(a)
end
children = []
queue = []
queue.push(1)
while queue.size > 0
  i = queue.shift
  
  children[i] = ary[i].select{|c| children[c].nil? }
  queue += children[i]

end

q_ary = [0]*(n+1)
q.times do 
  p , x = gets.split.map(&:to_i)
  q_ary[p] += x
end

result = []

queue.push(1)
while queue.size > 0
  i = queue.shift
  
  x = q_ary[i]
  result[i] = x
  children[i].each do |j|
    q_ary[j] += x
  end
  queue += children[i]

end
result.shift
puts result.join(" ")

