let refs = System.Collections.Generic.SortedDictionary<_,_>()
let [|n; q|] = stdin.ReadLine().Split(' ') |> Array.map int
let mutable cache = Array.create n 0

for i in 1..(n - 1) do
    let [|a; b|] = stdin.ReadLine().Split(' ') |> Array.map int
    match refs.TryGetValue b with
    | true, ref -> ()
    | false, _ -> refs.Add(b, a)
    
for i in 1..q do
    let [|p; x|] = stdin.ReadLine().Split(' ') |> Array.map int
    let value = cache |> Array.item (p - 1)
    Array.set cache (p - 1) (value + x) 

for i in 1..n do
    let value = cache |> Array.item (i - 1)
    match refs.TryGetValue i with
    | false, _ -> ()
    | true, ref ->
        let refValue = cache |> Array.item (ref - 1)
        Array.set cache (i - 1) (value + refValue)

let rec printList lst =
    match lst with
    | [] -> printf "\n"
    | [x] -> printf "%d" x
    | x :: tail ->
         printf "%d " x
         printList tail

printList (Array.toList cache)
