lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
Q = lines[0][1]

access = []
for i in 1..N do
  access[i-1] = []
end
for i in 1..N-1 do
  from = lines[i][0]
  to = lines[i][1]
  access[from-1].push(to)
end

count = []
for i in 1..N do
  count[i-1] = 0
end
for i in 1..Q do
  node = lines[N+i-1][0]
  point = lines[N+i-1][1]
  count[node-1] += point
end
ans = count

visited = []
for i in 1..N do
  visited[i-1] = false
end

target = [1]
while target != [] do
  next_target = []
  target.each do |i|
    access[i-1].each do |j|
      if visited[j-1] == false then
        ans[j-1] += ans[i-1]
        visited[j-1] = true
        next_target.push(j)
      end
    end
  end
  target = next_target
end
  
for i in 1..N do
  print ans[i-1].to_s + " "
end