13389 - Two-Phase Sorting   

Description

Denny just learned the sorting method in school.

Sorting once is too easy for him, so the teacher asked a question that needs to be sorted twice to test him.

In this question, you will get N strings of length 6, you need to sort the strings internally according to a ~ z, and then sort the N strings in dictionary order.

 

For example:

N = 2

S1 = abcabc, S2 = ababab

Internally sorted string: S1 = aabbcc, S2 = aaabbb

The sorted string after sorting: aaabbb aabbcc

Input

The first line contains a integer N, the number of strings you need to sort

The following line contains N strings S1 ~ SN

For all testcase:

1 <= N <= 100

Output

The Output contains only one line, the sorted string after sorting.

note: remember to add a '\n' in the end of output

Sample Input  Download

Sample Output  Download

Tags




Discuss