Little Ravi is designing an application but has got some problems. His application should keep the input strings in lexicographical order which isn't working properly.
Please help Little Ravi in completing his application. Ravi has N strings which will be given to you that are to be arranged in lexicographical order.
The strings have both capital and small letters. In general, their is no priority when strings do not spell the same. But if the strings spell same, small letter is considered having higher priority over capital letters.
A string may contain multiple words. Also a space is of higher priority over any alphabets.
Refer sample test cases for proper understanding.
Input :
First line has number of test cases.
First line of each test case has N(Number of strings Little Ravi has).
Next N lines has a string in each line.
It is guaranteed that string doesn't start or end with a space.
Output :
For each test case, print N lines with a string in each line in order as described.
Constraints :
1 ≤ T ≤ 1000
1 ≤ N ≤ 1000
1 ≤ |S| ≤ 1000, |S| means length of string.
Sum of length of strings over all test cases in an input file wouldn't exceed 107