시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 7 2 2 50.000%

문제

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.

예제 입력

3
ALCATRAZ
CARDAMOM
BAKLAVA

예제 출력

AVALKAB
MOMADRAC
ZARTACLA

힌트