n, q = gets.chomp.split(' ').map{|v| v.to_i}
tree = {}
(n-1).times {|n|
    a, b = gets.chomp.split(' ').map{|v| v.to_i}
    sym = a.to_s.to_sym
    if tree[sym].nil?
        tree[sym] = {
            :count => 0,
            :children => [b],
        }
    else
        tree[sym][:children].push(b)
    end
    
    if tree[b.to_s.to_sym].nil?
        tree[b.to_s.to_sym] = {
            :count => 0,
            :children => [],
        }
    end
}

q.times {
    w, x = gets.chomp.split(' ').map{|v| v.to_i}
    tree[w.to_s.to_sym][:count] += x
}

def update_count(tree, total, index)
    sym = index.to_s.to_sym
    tree[sym][:count] += total
    
    tree[sym][:children].each{|c|
        update_count(tree, tree[sym][:count], c)
    }
end

update_count(tree, 0, 1)

puts n.times.to_a.map{|v| tree[(v+1).to_s.to_sym][:count]}.join(' ')