A single DNA molecule is a string from an alphabet containing the four characters A(denine), G(uanine), and T(hymine), and C(ytosine)¡ªthe first letters of the names of four nitrogen bases. Because we have no way of getting the entire string directly for DNA, we adopt an idea to break them up into fragments at random locations, and obtain a large number of substrings of the string. Because of how they are created, many of these substrings will overlap. We want to reconstruct the sequence. There is not generally a unique solution, so we will find one that yields the shortest possible string. For example, here are a set of fragments aligned above a strand they might come from:

Input

The input to your program will consist of one or more sets of data in free format. Each set starts with an integer, N(1 <= N <= 15), followed by N fragments. Each fragment is a string of no more than 100 characters from the (upper-case) AGTC alphabet. A set starting with the integer 0 terminates the input.

Output

for the output, printing in ten groups of three per line (or possibly fewer at the end of the string) and leaving a blank line between sets. If there are several such strings of shortest length, find the smallest in alphabetical/lexicographical order.