시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB113777072.165%

문제

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.

예제 입력 1

3
ALCATRAZ
CARDAMOM
BAKLAVA

예제 출력 1

AVALKAB
MOMADRAC
ZARTACLA