stdin.ReadLine()
|> fun x -> x.Split(' ') |> Array.map int |> fun x -> (x.[0], x.[1])
|> fun (n, q) ->
  (
    [1..(n - 1)] |> List.map (fun _ -> stdin.ReadLine() |> fun x -> x.Split(' ') |> Array.map int |> fun x -> (x.[0], x.[1])),
    [1..q]       |> List.map (fun _ -> stdin.ReadLine() |> fun x -> x.Split(' ') |> Array.map int |> fun x -> (x.[0], x.[1]))
  )
  |> fun (es, ps) ->
    (
      es
      |> List.fold (
        fun map (a, b) ->
          map
          |> Map.tryFind a
          |> fun t ->
            match t with
            | Some cs -> map.Remove(a).Add(a, b::cs)
            | None -> map.Add(a, [b])
      ) Map.empty,
      ps
      |> List.fold (
        fun map (p, x) ->
          map
          |> Map.tryFind p
          |> fun t ->
            match t with
            | Some y -> map.Remove(p).Add(p, x + y)
            | None -> map.Add(p, x)
      ) Map.empty
      |> Map.toList
    )
  |> fun (pcs, ps) ->
    ps
    |> List.fold (
      fun arr (p, x) ->
        [1..n]
        |> List.fold (
          fun (arr, stack) _ ->
            match stack with
            | [] ->
              (arr, stack)
            | i::ts -> 
              (
                Array.concat [ arr.[0..(i - 1)]; [| arr.[i] + x |]; arr.[(i + 1)..] ],
                pcs
                |> Map.tryFind i
                |> fun cs ->
                  match cs with
                  | Some cs -> cs @ ts
                  | None -> ts
              )
        ) (arr, [p])
        |> fun (arr, _) -> arr
    ) (Array.zeroCreate (n + 1))
|> fun arr ->
  arr
  |> Array.skip 1
  |> Array.map string
  |> String.concat " "
|> printfn "%s"
