n, q = gets.chomp.split(' ').map(&:to_i)

relations = []

(n - 1).times do
    a, b = gets.chomp.split(' ').map(&:to_i)
    a -= 1
    b -= 1
    relations[a] = [] unless relations[a]
    relations[a].push(b)
end

def create_tree(tree, root, relations)
    tree[root] = {val: 0, children: relations[root] || []}
    tree[root][:children].each do |c|
        create_tree(tree, c, relations)
    end
    return tree
end

tree = create_tree([], 0, relations)

def sum(tree, i, n)
    tree[i] = {val: 0, children:[]} unless tree[i] 
    tree[i][:val] += n
    tree[i][:children].each do |child|
        sum(tree, child, n)
    end
end

q.times do |i|
    root, n = gets.chomp.split(' ').map(&:to_i)
    root -= 1
    sum(tree, root, n)
end

puts tree.map{|a| a[:val]}.join(' ')
