LearnPy Hub
← Arena
AdvancedRating 1800

Alien Alphabet

The words are sorted in an unknown alphabet. Work out the order of the letters that appear. If several orders work, print the alphabetically smallest; if the list is inconsistent, print IMPOSSIBLE.

Input

n, then n words separated by spaces.

Output

A string or IMPOSSIBLE.

Sample 1

Input
5
wrt wrf er ett rftt
Output
wertf

Sample 2

Input
2
z x
Output
zx
solution.py
Output appears here
Alien Alphabet · Python Arena problem · LearnPy Hub