Sorting the Jewelry

No attempts yetTime limit1sMemory limit512 MB

Problem

Malgosia inherited a collection of precious jewelry from her uncle. The treasury was in artistic disarray, so she decided to put it in order. The jewelry consists of necklaces made of precious and rare gemstones, and no two of them are alike. Help Malgosia organize this valuable collection.

Write a program that:

  • reads the descriptions of the jewelry from standard input,
  • sorts them by increasing length, breaking ties among equal-length descriptions lexicographically,
  • prints the sorted strings to standard output.

Strings of equal length are ordered lexicographically: of two different strings of equal length, the smaller one is the string that has the smaller character at the first position where they differ.

Input

The first line contains the number of strings to analyze NN (N150N \le 150). Each of the next NN lines contains the description of one piece of jewelry. Each description is a non-empty string of lowercase Latin letters ('a'..'z'), corresponding to the gemstones used, with length not exceeding 200200 characters.

Output

Print the strings in ascending order, one per line.