class Array
    def all_add!(point,x,task,count)
        count[point] = x = (x + task[point])
        
        self[point].map{|i| self.all_add!(i,x,task,count)} if !self[point].empty?
        
        self
    end
end

N,Q = gets.split.map(&:to_i)
ab = (N-1).times.map{gets.split.map(&:to_i)}
px = Q.times.map{gets.split.map(&:to_i)}

count = Array.new(N+1)
tree = Array.new(N+1).map{Array.new()}
task = Array.new(N+1,0)

(N-1).times{
    a = ab.pop
    tree[a[0]].push a[1]
}

px.map{|x|
    task[x[0]] += x[1]
}

tree.all_add!(1,0,task,count)

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