let cache = System.Collections.Generic.SortedDictionary<_,_>()
let refs = System.Collections.Generic.Dictionary<_,_>()
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])
    ]
let pxList = [for i in 1..q do
                let [|p; x|] = stdin.ReadLine().Split(' ') |> Array.map int
                yield p, x]
         
let rec add (p, x) =
    match cache.TryGetValue p with
    | true, v -> cache.Remove(p) |> ignore; cache.Add(p, v + x)
    | false, _ -> cache.Add(p, x)
    match refs.TryGetValue p with
    | false, _ -> ()
    | true, ref -> ref |> List.map (fun b -> add (b, x)) |> ignore
       
pxList |> List.map(add)
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
