Sphere Online Judge

SPOJ Problem Set (tutorial)

511. Easy Sorting

Problem code: LEXISORT

Given is a list of words and a lexicographical ordering according to the ascii alphabet. Your task is to sort the words in increasing order.

Input

The first line contains the numbers of testcases k (k< 100). Every testcase c onsists of n+1 (1< n< 50000) lines. Each line contains of a string of 10 character s. The first line of each testcase contains n.

Output

Output the sorted list of words.

Example

Input:
2
2
helloworld
worldhello
2
aaaaaaaaaa
Aaaaaaaaaa
Output:
helloworld
worldhello
Aaaaaaaaaa
aaaaaaaaaa

Added by:Simon Gog
Date:2005-04-13
Time limit:4s
Source limit:8083B
Languages:All except: CLOJ F# PERL 6 TECS

SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.