cho.sh
Notes
Loading...

Minsik Language Word Sorting

Time limit

2s

Memory limit

128 MB

Problem

The Minsik language has the following 20 letters, and dictionary order follows this order.

a b k d e g h i l m n ng o p r s t u w y

The sequence ng is not two separate letters; it is treated as one letter placed between n and o. Whenever ng appears in a word, compare it as that single letter.

Given several words in the Minsik language, sort them in dictionary order according to this alphabet.

Input

The first line contains the number of Minsik language words, N. N is a positive integer not greater than 50.

Each of the next N lines contains one Minsik language word. Each word has length at most 50. No input word contains a letter outside the Minsik alphabet, and all words are distinct.

Output

Print the sorted words, one per line.