let f s =
  let g = Str.split (Str.regexp " ") s
            |> List.map int_of_string
            |> Array.of_list
  in
  (g.(0)*3600 + g.(1)*60 + g.(2), g.(3)*3600 + g.(4)*60 + g.(5))
;;

let print time =
  Printf.printf "%d %d %d\n" (time/3600) ((time/60) mod 60) (time mod 60)

let () =
  let (a1, a2) = read_line () |> f and
      (b1, b2) = read_line () |> f and
      (c1, c2) = read_line () |> f in
  print (a2-a1);print (b2-b1);print (c2-c1)
;;