n,q=gets.chomp.split(" ").map(&:to_i)
table=Array.new(n+1).map{Array.new}
$tree=Array.new(n+1){0}
def search(table,searchList,x)
	searchList.each do|idx|
		$tree[idx]+=x
		search(table,table[idx],x) if(table[idx]!=[])
	end
end
(n-1).times do|i|
	a,b=gets.chomp.split(" ").map(&:to_i)
	table[a].push(b)
end
table.map{|i| i.sort! if(i!=nil)}
q.times do|i|
	pidx,x=gets.chomp.split(" ").map(&:to_i)
	$tree[pidx]+=x
	search(table,table[pidx],x) if(table[pidx]!=[])
end
$tree.shift()
$tree.each do|num|
	print("#{num} ")
end