For years, before computers, Merriam Webster maintained a Backward Index of all of the words in the English language. They had all of the words on cards, one word per card, backwards. The cards were alphabetized. This was very useful, before computers, to determine such things as ‘How many words end with ‘TION’?’ Given a list of words consisting of only capital letters, create a Backward Index by reversing them and printing the reversals in alphabetical order.
Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. The first line of input will contain an integer n (1≤n≤1,000) indicating the number of words. On the following n lines will be the words, one per line. The words will be from 1 to 100 letters long. The words will consist of only capital letters, and there will be no spaces or blank lines.
Output the words, reversed and sorted, one word per line.