Under construction

Still being built. Things may change

Time

Time limit1sMemory limit1024 MB

Summary
Given the departure and arrival times of three cars, find the shortest and longest trip durations and print them as hh:mm.
Level

Easy2 of 10

Topics
Implementation, Math
Solved
No attempts yet

Problem

Three cars start a trip along the same route at different times and arrive at the final point at different times. Write a program time that finds the minimum and maximum time it took to cover the distance.

Input

The first three lines of standard input each contain four integers: the departure time and the arrival time of one car, given in hours and minutes. The numbers are separated by single spaces.

Output

The first line of standard output must contain the minimum time (in hours and minutes) needed to cover the distance. The second line must contain the maximum time. Print each time in the format hh:mm.

Constraints

0≤hh<240 \le hh < 24, 0≤mm<600 \le mm < 60

Examples1

  1. Example 1

    Input
    23 30 1 30
    2 5 5 15
    15 5 20 53
    
    Expected output
    2:00
    5:48