# POTD 12 skel
# Author: <anonymized>
# Date: 11/03/2025
# Description: POTD12 Checks for Time Conflict
import sys

def to_seconds(hms_tuple):
    """ Returns the total number of seconds represented by a duration given as
    a 3-tuple containing (hours, minutes, and seconds). """
    (h, m, s)=hms_tuple
    return(3600*h+60*m+s)

def to_hms(seconds):
    """ Returns a tuple of (hours, minutes, seconds) for the given
    raw number of seconds. Precondition: seconds >= 0. """
    h = seconds//3600
    m = (second % 3600) // 60
    s = seconds % 60
    return (h,m,s)

def conflicts(start_time, end_time, query_time):
    """ Returns whether query_time is inside the interval from start_time to
    end_time, including the endpoints. Preconditions: Input times are given
    as 3-tuples of (hour, minute, second) in 24h format, and start_time is
    before end_time (on the same day). """
    start=to_seconds(start_time)
    end=to_seconds(end_time)
    query=to_seconds(query_time)
    return(start<=query<=end)
    

if __name__ == "__main__":
    start_t = int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3])
    end_t   = int(sys.argv[4]), int(sys.argv[5]), int(sys.argv[6])
    query_t = int(sys.argv[7]), int(sys.argv[8]), int(sys.argv[9])
    
    if conflicts(start_t,end_t,query_t):
        print(f"{query_t} conflicts with the interval from {start_t} to {end_t}")
    else:
        print(str(to_hms(to_seconds(query_t)))+" does not conflict with the interval from "+str(to_hms(to_seconds(start_t)))+" to "+str(to_hms(to_seconds(end_t))))
    
