func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e6 + 10;   const int MAXM = 4e6 + 10;   const long long MOD = 1e9 + 7;   const long long INF = 0x3f3f3f3f;   const unsigned long long BASE = 233;   const int base = 5;   mt19937_64 mt(time(0));   char rubbish[110];   bool GETDATA;   inline long long read() {     long long x = 0, f = 1;     char ch;     do {       ch = getchar();       if (ch ==  - ) f = -1;     } while (ch <  0  || ch >  9 );     do {       x = x * 10 + ch - 48;       ch = getchar();     } while (ch >=  0  && ch <=  9 );     return x * f;   }   inline void write(long long x, char con =   n ) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) write(x / 10, 0);     putchar(x % 10 +  0 );     if (con) {       printf( %c , con);     }   }   long long N, M, K, Q;   long long a[MAXN];   char s[MAXN][110];   int sz[MAXN];   vector<int> es[30];   vector<pair<int, int> > tot;   vector<int> topsort;   bool occ[30];   bool vis[30];   int ord[30];   void dfs(int u) {     vis[u] = true;     for (auto v : es[u]) {       if (!vis[v]) {         dfs(v);       }     }     topsort.push_back(u);   }   void init() {     for (int i = 0; i < 30; i++) {       es[i].clear();       occ[i] = false;       vis[i] = false;     }     tot.clear();     topsort.clear();   }   void solve() {     long long ans = 0;     int now;     int id;     N = read();     M = read();     init();     for (int i = 0; i < N; i++) {       now = read();       for (int j = 0; j < M; j++) {         id = now * N + j;         scanf( %s , s[id]);         for (sz[id] = 0; s[id][sz[id]] !=   0 ; sz[id]++) {           occ[s[id][sz[id]] -  a ] = true;         }       }     }     for (int i = 1, j; i < N * M; i++) {       now = min(sz[i - 1], sz[i]);       for (j = 0; j < now; j++) {         if (s[i - 1][j] != s[i][j]) {           break;         }       }       if (j < now) {         es[s[i][j] -  a ].push_back(s[i - 1][j] -  a );         tot.push_back(pair<int, int>{s[i][j] -  a , s[i - 1][j] -  a });       } else if (sz[i - 1] > sz[i]) {         printf( IMPOSSIBLE n );         return;       }     }     for (int i = 0; i < 26; i++) {       if (occ[i] && !vis[i]) {         dfs(i);       }     }     for (int i = 0; i < topsort.size(); i++) {       ord[topsort[i]] = i;     }     for (auto x : tot) {       if (ord[x.first] < ord[x.second]) {         printf( IMPOSSIBLE n );         return;       }     }     for (auto ch : topsort) {       printf( %c , ch +  a );     }     printf(  n );   }   int main() {     int T;     T = 1;     for (int t = 1; t <= T; t++) {       GETDATA = false;       solve();     }     return 0;   }   