n,q=gets.split.map(&:to_i)
edges=Array.new(n+1){Array.new}
(n-1).times{
  a,b=gets.split.map(&:to_i)
  edges[a] << b
  edges[b] << a
}
score=Array.new(n+1,0)
q.times{
  p,x=gets.split.map(&:to_i)
  score[p]+=x
}
visited=Array.new(n+1)
queue=[1]
until queue.empty?
  p=queue.shift
  visited[p]=true
  edges[p].each{|q|
    next if visited[q]
    score[q]+=score[p]
    queue << q
  }
end

puts score[1..n].join(" ")