408631: GYM103241 F Books
Description
Ryan is a bookworm. He has many books on his shelf, and he wants to sort them alphabetically by their first letter. Furthermore, he wants to sort the books that have the same starting letter by their published years, from oldest to most recent. Note that all the book titles are one word, with all lowercase letters.
InputThe first line has an integer $$$1 < N < 10000$$$, representing the number of books Ryan has on his shelf.
The next $$$N$$$ lines contain $$$A$$$ and $$$B$$$, where $$$A$$$ is the name of the book (the length of the book title will be $$$3 \leq A < 13$$$) and $$$0 \leq B < 10000$$$ is the publish year.
OutputPrint the final sorted bookshelf, with the name of each book on a separate line.
ExampleInput4 harry 1987 orange 1776 hotels 1973 moon 2018Output
hotels harry moon orangeNote
Problem idea: Spark
Problem preparation: Spark
Occurances: Novice 6