#Input the time
input_time = input('What time is it?' )

#Split the string into hours and minutes
time_hours, time_minutes = input_time.split(":")

#This will convert military hours to regular hours, and determine AM vs PM
def HoursParser(hour):
    num_to_text={
        0:"twelve",1:"one",2: "two",3: "three",
        4: "four", 5: "five", 6: "six",
        7: "seven", 8: "eight", 9: "nine",
        10: "ten", 11: "eleven", 12: "twelve"
        }
    if hour>=12:
        am_or_pm = "pm"
        reg_time_hours = abs(hour-12)
    else:
        am_or_pm = "am"
        reg_time_hours = hour
    return(num_to_text[reg_time_hours],am_or_pm)

def MinutesParser(minutes):
    if int(minutes) < 20: #Handle all the weird cases (i.e., teens).
        min_to_text1_dict={
            0:"",1:"oh one",2: "oh two",3: "oh three",
            4: "oh four", 5: "oh five", 6: "oh six",
            7: "oh seven", 8: "oh eight", 9: "oh nine",
            10: "ten", 11: "eleven", 12: "twelve",
            13: "thirteen", 14: "fourteen", 15: "fifteen",
            16: "sixteen", 17: "seventeen", 18: "eighteen",
            19: "nineteen"          
        }
        return min_to_text1_dict[int(minutes)]
    if int(minutes) > 20: #Handle everything else that follows sane rules.
        min_tens_dict={
        "2":"twenty","3":"thirty","4":"forty","5":"fifty"
        }
        min_ones_dict={
        "0":"","1":"one","2": "two","3": "three",
        "4": "four", "5": "five", "6": "six",
        "7": "seven", "8": "eight", "9": "nine",
        }
        mins_together = min_tens_dict[minutes[:1]] + min_ones_dict[minutes[1:]]
        return mins_together
    
text_hours, am_pm = HoursParser(int(time_hours))
text_minutes = MinutesParser(time_minutes)
print("It's "+text_hours+" "+text_minutes+" "+am_pm)