Avoiding a Disaster

Interview

Time limit1sMemory limit128 MB

Summary
Three 12-hour watch readings come from one correct time, one watch x minutes slow, and one x minutes fast, with x at most 480; find the unique correct time or report ambiguity.
Level

Medium4 of 10

Topics
Brute force, Implementation, Math, Simulation
Solved
No attempts yet

Problem

Percy likes to be punctual — so much so that he always carries three watches with him, so that he can always be sure of the exact time. Today, though, is a bad day. Percy discovered that one of his three watches was showing the wrong time: it was running xx minutes slow (with x≤480x \le 480). Worse still, when he went to correct that watch he adjusted the wrong one, winding one of the other two watches xx minutes forward instead. As a result his three watches now show three different times, and Percy is in serious danger of being late.

Given the three times shown on the watches, determine the correct current time. Every watch is an ordinary 12-hour analog watch, so the time wraps around every 12 hours.

Input

The first line contains an integer TT, the number of test cases (0<T<1000 < T < 100). Each of the next TT lines contains one test case: three watch readings separated by single spaces, in the form H1:M1 H2:M2 H3:M3.

In each reading the hour satisfies 1≤Hi≤121 \le H_i \le 12 and the minute satisfies 0≤Mi≤590 \le M_i \le 59. Minutes are always written with two digits, so a leading zero is added when the minute is less than 10.

Output

For each test case print one line. If the correct time can be determined uniquely, print exactly:

The correct time is H:M

The minute MM is printed with two digits (a leading zero is added when it is less than 10), and the hour HH is printed without a leading zero. If the correct time cannot be determined uniquely from the three readings, print exactly:

Look at the sun

Examples1

  1. Example 1

    Input
    3
    5:00 12:00 10:00
    11:59 12:30 1:01
    12:00 4:00 8:00
    
    Expected output
    The correct time is 5:00
    The correct time is 12:30
    Look at the sun