import re
import datetime
inp = '''
6 Jan @ 4:03pm
8 Jan @ 2:17pm
9 Dec @ 4:00am
9 Dec @ 5:14pm
9 Dec @ 5:28am
10 Jan @ 2:55pm
10 Jan @ 4:21am
10 Jan @ 7:14pm
12 Dec @ 7:48pm
12 Dec @ 7:50pm
12 Jan @ 3:32pm
13 Dec @ 3:43pm
13 Dec @ 5:02am
13 Dec @ 5:24am
14 Jan @ 5:17pm
15 Jan @ 5:29am
21 Dec @ 3:56pm
21 Dec @ 9:40am
'''
regex = re .compile ( r'(\d + \w +) @ (\d +:\d +)(\w [m])' )
dates = regex.findall ( inp)
listofdates = [ ]
out = [ ]
for i in range ( 0 , len ( dates) ) :
dt = datetime .datetime .strptime ( dates[ i] [ 0 ] + ' ' + dates[ i] [ 1 ] + dates[ i] [ 2 ] , "%d %b %I:%M%p" )
listofdates.append ( dt)
listofdates.sort ( )
for i in range ( len ( listofdates) ) :
at = listofdates[ i] .strftime ( '%d %b @ %I:%M%p' )
out.append ( at)
print ( '\n ' .join ( out) )
aW1wb3J0IHJlCmltcG9ydCBkYXRldGltZQoKaW5wID0gJycnCjYgSmFuIEAgNDowM3BtCjggSmFuIEAgMjoxN3BtCjkgRGVjIEAgNDowMGFtCjkgRGVjIEAgNToxNHBtCjkgRGVjIEAgNToyOGFtCjEwIEphbiBAIDI6NTVwbQoxMCBKYW4gQCA0OjIxYW0KMTAgSmFuIEAgNzoxNHBtCjEyIERlYyBAIDc6NDhwbQoxMiBEZWMgQCA3OjUwcG0KMTIgSmFuIEAgMzozMnBtCjEzIERlYyBAIDM6NDNwbQoxMyBEZWMgQCA1OjAyYW0KMTMgRGVjIEAgNToyNGFtCjE0IEphbiBAIDU6MTdwbQoxNSBKYW4gQCA1OjI5YW0KMjEgRGVjIEAgMzo1NnBtCjIxIERlYyBAIDk6NDBhbQonJycKCnJlZ2V4ID0gcmUuY29tcGlsZShyJyhcZCsgXHcrKSBAIChcZCs6XGQrKShcd1ttXSknKQpkYXRlcyA9IHJlZ2V4LmZpbmRhbGwoaW5wKQoKbGlzdG9mZGF0ZXMgPSBbXQpvdXQgPSBbXQogICAgCmZvciBpIGluIHJhbmdlKDAsIGxlbihkYXRlcykpOgogICAgZHQgPSBkYXRldGltZS5kYXRldGltZS5zdHJwdGltZShkYXRlc1tpXVswXSArICcgJyArIGRhdGVzW2ldWzFdICsgZGF0ZXNbaV1bMl0sICIlZCAlYiAlSTolTSVwIikKICAgIGxpc3RvZmRhdGVzLmFwcGVuZChkdCkKCmxpc3RvZmRhdGVzLnNvcnQoKQoKZm9yIGkgaW4gcmFuZ2UobGVuKGxpc3RvZmRhdGVzKSk6CiAgICBhdCA9IGxpc3RvZmRhdGVzW2ldLnN0cmZ0aW1lKCclZCAlYiBAICVJOiVNJXAnKQogICAgb3V0LmFwcGVuZChhdCkKCnByaW50KCdcbicuam9pbihvdXQpKQ==