Imports System.Collections.Generic
Public Class Program
  Shared Sub Main()
    Dim nq As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim n As Long = nq(0)
    Dim q As Long = nq(1)
    Dim ans(0 To n - 1) As Long
    For i As Long = 0 To n - 1
      ans(i) = 0
    Next
    Dim ki As Dictionary(Of Long, List(Of Long)) = New Dictionary(Of Long, List(Of Long))()
    For i As Long = 0 To n - 2
      Dim ab As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
      Dim a As Long = ab(0)
      Dim b As Long = ab(1)
      If ki.ContainsKey(a) Then
        ki(a).Add(b)
      Else
        Dim l As List(Of Long) = New List(Of Long)()
        l.Add(b)
        ki.Add(a, l)
      End If
    Next
    For i As Long = 0 To q - 1
      Dim px As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
      Dim p As Long = px(0)
      Dim x As Long = px(1)
      ans(p - 1) += x
      AddCounter(ki, p, x, ans)
    Next
    Console.WriteLine(String.Join(Of Long)(" ", ans))
  End Sub
  
  Shared Sub AddCounter(ki As Dictionary(Of Long, List(Of Long)), p As Long, x As Long, ByRef ans As Long())
    If ki.ContainsKey(p) Then
      For Each k As Long In ki(p)
        ans(k - 1) += x
        AddCounter(ki, k, x, ans)
      Next
    End If
  End Sub
End Class