Skip to content

Instantly share code, notes, and snippets.

@washingtonsoares
Created May 20, 2022 15:59
Show Gist options
  • Save washingtonsoares/5aa2aa9b23aa5ce79febf2cee74a1e96 to your computer and use it in GitHub Desktop.
Save washingtonsoares/5aa2aa9b23aa5ce79febf2cee74a1e96 to your computer and use it in GitHub Desktop.
testCount = 0
while True:
try:
n = int(input())
if (n == 0):
break
if (testCount > 0):
print("")
tShirtsToMake = []
for i in range(n):
name = input()
color, size = input().split(" ")
tShirtsToMake.append({"name": name, "color": color, "size": size})
tShirtsToMake.sort(key=lambda item: (
item['color'], -(ord(item['size'])), item['name']))
for item in tShirtsToMake:
print(item['color'] + " " + item['size'] + " " + item['name'])
testCount += 1
except EOFError:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment