N,Q=gets.split.map &:to_i
edges=Array.new(N+1){Array.new}
(N-1).times do
    i,j=gets.split.map(&:to_i)
    edges[i] << j
    edges[j] << i
end
value=Array.new(N+1,0)
Q.times do
    i,j=gets.split.map(&:to_i)
    value[i]+=j
end

ans=Array.new(N+1,false)
ans[0]=0
check=[[0,1]]

until check.empty?
    parent,node=check.pop
    ans[node]=ans[parent]+value[node]
    edges[node].each do |i|
        next if ans[i]
        check << [node,i]
    end
end
puts ans[1..-1].join(" ")
