#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 def[52]; string x[52], y[52]; void ng() { cout << "Impossible" << endl; exit(0); } int cnt = 0; void f(int cu) { if(cnt++ == 3000000) { ng(); } if(cu == 52) { if(sz(us) == 2 * N) { rep(i, N)cout << x[i] << ' ' << y[i] << endl; exit(0); } else { return; } } int non = 1; char c = ALPHA[cu]; rep(i, N) if(!def[i]){ string &u = U[i]; def[i] = 1; if(u[0] == c) { non = 0; x[i] = u.substr(0, 1); y[i] = u.substr(1, 2); if(us.count(y[i]) + us.count(x[i]) == 0) { us.insert(x[i]); us.insert(y[i]); f(cu + 1); us.erase(x[i]); us.erase(y[i]); } } if(u[2] == c) { non = 0; x[i] = u.substr(0, 2); y[i] = u.substr(2, 1); if(us.count(x[i]) + us.count(y[i]) == 0) { us.insert(x[i]); us.insert(y[i]); f(cu + 1); us.erase(x[i]); us.erase(y[i]); } } def[i] = 0; } f(cu + 1); } int main(){ ios::sync_with_stdio(false); cin.tie(0); cin >> N; rep(i, N)cin >> U[i]; if(N > 52) { ng(); } f(0); ng(); }