favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Grouped Word

A word is grouped if, for each letter in the word, all occurrences of that letter form exactly one consecutive sequence. In other words, no two equal letters are separated by one or more letters that are different. For example, the words "ccazzzzbb" and "code" are grouped, while "aabbbccb" and "eolimpeolimp" are not.

A grouped word was divided into several parts. You are given all the parts in random order. Reconstruct the original word and print it.

Input

Consists of multiple test cases. The first line of each test case contains the nuumber n (1 ≤ n ≤ 50) of word parts. The second line contains n parts of the word in random order. The length of each part is no more than 20 symbols 'a' - 'z'.

Output

For each test case print in a separate line the original word. If there is more than one possible answer, print "MANY" instead. If no grouped word could have resulted in the given parts, print "IMPOSSIBLE" instead.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3
aaa a aa
2
ab bba
4
orr rd woo www
1
abcb

Output example #1
aaaaaa
IMPOSSIBLE
wwwwooorrrd
IMPOSSIBLE