Time limit
1s
Memory limit
128 MB
Koong shows Dobby several English words and says Dobby will be set free if he can identify the word that comes first in dictionary order when letter case is ignored.
To make the task harder, Koong mixes uppercase and lowercase letters freely. For example, apPle comes before Bat, but after AnT.
For each test case, find the word that is earliest in case-insensitive dictionary order, and print it exactly as it appeared in the input.
The input consists of several test cases.
Each test case begins with an integer n, the number of words. Here, 2 <= n <= 1000.
Each of the next n lines contains one English word of length at most 20. Within one test case, no two words become the same after ignoring case.
The input ends with a single 0.
For each test case, print the word that comes first in case-insensitive dictionary order, preserving its original capitalization.