#include using namespace std; map mp; string ans[105][2]; bool fnd; void dfs(int i, int n, string u[]) { if (fnd) return; if (i == n) { fnd = true; for (int j = 0; j < n; j++) { cout << ans[j][0] << " " << ans[j][1] << endl; } return; } string s = u[i]; for (int j = 1; j < 3; j++) { string a = s.substr(0, j); string b = s.substr(j); if (!mp[a] && !mp[b]) { mp[a] = mp[b] = true; ans[i][0] = a; ans[i][1] = b; dfs(i + 1, n, u); mp[a] = mp[b] = false; } } } int main() { int n; cin >> n; string u[105]; for (int i = 0; i < n; i++) { cin >> u[i]; } fnd = false; dfs(0, n, u); if (!fnd) { cout << "Impossible" << endl; } return 0; }