Fragment Reassembly

No attempts yetTime limit1sMemory limit128 MB

Problem

A secret document was shredded into overlapping text fragments. Read the fragment lists and reassemble them by matching overlaps.

Input

Several problems follow. Each problem has 1 to 20 fragment lines terminated by a line containing only #. Each line has 1 to 72 printable characters; words are separated by a single space. # marks the end of a problem and of the whole input. Duplicate fragments may appear.

Output

For each problem, print any arrangement of the fragments where every input fragment appears and adjacent fragments overlap exactly. Each output line has at most 72 characters. Break lines only at word boundaries and do not print the separating space at a break. Do not insert blank lines between problems.