#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define mt make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; const string ALPHA="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int N; string U[100001]; map ms; set us; int x[52]; void ng() { cout << "Impossible" << endl; exit(0); } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> N; if(N > 52) ng(); rep(i, N)cin >> U[i]; rep(i, N) { ms[U[i].substr(0, 1)]++; ms[U[i].substr(1, 2)]++; } rep(hoge, 10000) { rep(i, N) { string s, t; s = U[i].substr(0, 1+x[i]), t = U[i].substr(1+x[i], 2-x[i]); int y = !x[i]; string u = U[i].substr(0, 1 + y), v = U[i].substr(1 + y, 2 - y); cerr << s << ' ' << t << endl; if(ms[s] > 1 || ms[t] > 1) { ms[s]--; ms[t]--; if(!ms[u] && !ms[v])x[i] = y, ms[u]++, ms[v]++; else ms[s]++, ms[t]++; } else if(ms[s] == 1 && ms[t] == 1) { ms[s]--; ms[t]--; if(ms[u] == 0 && ms[v] == 0) { y = rand() % 2; U[i].substr(0, 1 + y), v = U[i].substr(1 + y, 2 - y); ms[u]++; ms[v]++; } else ms[s]++, ms[t]++; } } } each(p, ms)if(p.second > 1)ng(); rep(i, N)cout << U[i].substr(0, 1 + x[i]) << ' ' << U[i].substr(1 + x[i], 2 - x[i]) << endl; }