#include <iostream>
#include <vector>
const int NMAX=28;
using namespace std;
int f[NMAX], t[NMAX];
vector <int> v[NMAX], ans;
char s[105][105];
int n;
bool gasit;
void dfs(int);
int main()
{
int i, j;
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(i=0; i<=26; i++) f[i]=t[i]=0;
cin>>s[1];
for(i=2; i<=n; i++)
{
cin>>s[i];
gasit=false;
for(j=0; s[i][j]&&s[i-1][j]; j++)
{
if(s[i][j]!=s[i-1][j])
{
gasit=true;
v[int(s[i-1][j]-'a')].push_back(int(s[i][j]-'a'));
f[int(s[i][j]-'a')]=++t[int(s[i][j]-'a')];
break;
}
}
if(gasit==false && s[i-1][j]!=0)
{
cout<<"Impossible"<<'\n';
return 0;
}
}
for(i=0; i<26; i++)
{
if(f[i]==0) dfs(i);
}
if(ans.size()!=26) cout<<"Impossible"<<'\n';
else
{
for(auto i:ans) cout<<char(i+'a');
cout<<'\n';
}
return 0;
}
void dfs(int nod)
{
if(t[nod]==0) ans.push_back(nod);
for(auto i:v[nod])
{
t[i]--;
if(t[i]==0) dfs(i);
}
}
988B - Substrings Sort | 312A - Whose sentence is it |
513A - Game | 1711E - XOR Triangle |
688A - Opponents | 20C - Dijkstra |
1627D - Not Adding | 893B - Beautiful Divisors |
864B - Polycarp and Letters | 1088A - Ehab and another construction problem |
1177B - Digits Sequence (Hard Edition) | 1155B - Game with Telephone Numbers |
1284A - New Year and Naming | 863B - Kayaking |
1395B - Boboniu Plays Chess | 1475D - Cleaning the Phone |
617B - Chocolate | 1051B - Relatively Prime Pairs |
95B - Lucky Numbers | 1692D - The Clock |
1553D - Backspace | 1670D - Very Suspicious |
1141B - Maximal Continuous Rest | 1341A - Nastya and Rice |
1133A - Middle of the Contest | 385A - Bear and Raspberry |
1311B - WeirdSort | 1713F - Lost Array |
236B - Easy Number Challenge | 275A - Lights Out |