In this problem, we link alphabets into a necklace. For example, imagine a string necklace -F-A-E-D-C-B-G- is made of alphabets {A, B, C, D, E, F, G}, and G is linked to F. In the necklace, each alphabet will appear at most once. Unfortunately, we can only see fractions of the necklace. But we are still lucky enough to put these fractions back to the original necklace.
From the previous example, we can only see the fractions {FAE, BGF, DCB, ED}, and these information is enough to fix the necklace FAEDCBGF. Note that G is also linked to F, that is why we have the fraction BGF.
In this problem, we are given fractions, and we are going to put these fractions together. Any 2 fractions could have only 1 overlap alphabet, and there is exactly one solution for this problem.
The first line on input contains a integer N, denoting the numbers of fractions. There are at least 2 fractions.
The second line is the fitst fraction, and we start to fix the necklace here.
The following N-1 lines contains other fractions. These fractions may be listed out of order.
Each fraction is made of uppercase alphabets 'A'-'Z', and the length is at least 2. Since there will not be any alphabets appear twice in the necklace, N is not greater than 26.
Print the necklace. In our example, print "FAEDCBGF\n" as the answer.