let cache = System.Collections.Generic.SortedDictionary<_,_>()
let refs = System.Collections.Generic.SortedDictionary<_,_>()
let [|n; q|] = stdin.ReadLine().Split(' ') |> Array.map int
for i in 1..(n - 1) do
    let [|a; b|] = stdin.ReadLine().Split(' ') |> Array.map int
    match refs.TryGetValue a with
    | true, ref -> refs.Remove(a) |> ignore; refs.Add(a, ref @ [b])
    | false, _ -> refs.Add(a, [b])
    
for i in 1..q do
    let [|p; x|] = stdin.ReadLine().Split(' ') |> Array.map int
    match cache.TryGetValue p with
    | true, v -> cache.Remove(p) |> ignore; cache.Add(p, v + x)
    | false, _ -> cache.Add(p, x)
        
let rec sum pre x =
    match cache.TryGetValue x with
    | false, _ ->
        cache.Add(x, pre)
        match refs.TryGetValue x with
        | false, _ -> ()
        | true, ref -> for r in ref do sum pre r
    | true, v ->
        cache.Remove(x) |> ignore
        cache.Add(x, v + pre)
        match refs.TryGetValue x with
        | false, _ -> ()
        | true, ref -> for r in ref do sum (v + pre) r

sum 0 1    

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

[for key in cache.Keys do
    match cache.TryGetValue key with
    | true, v -> yield v
    | false, _ -> yield 0]
|> printList
