N,Q = gets.split.map(&:to_i)
count = Array.new(N+1,0)
tree = Array.new(N+1,0)

(N-1).times.map{
    a,b = gets.split.map(&:to_i)
    tree[b] = a
}
Q.times.map{
    p,x = gets.split.map(&:to_i)
    count[p] += x
}
2.upto(N) do |node_n|
  count[node_n] += count[tree[node_n]]
end

puts count[1..N].join(" ")