n,q=gets.chomp.split(" ").map{|s| s.to_i}
a=[]
ans=Array.new(n+1,0)
for i in 0..n-2
  a[i]=gets.chomp.split(" ").map{|s| s.to_i}
end
a.sort!
for j in 0..q-1
  p,x=gets.chomp.split(" ").map{|s| s.to_i}
  ans[p]+=x
end
for i in 0..n-2
  ans[a[i][1]]+=ans[a[i][0]]
end

for i in 1..n
  print "#{ans[i]} "
end