import java.util.*; public class Main { static String[] strings; static int n; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); strings = new String[n]; for (int i = 0; i < n; i++) { strings[i] = sc.next(); } check(0, new HashSet(), new boolean[n]); System.out.println("Impossible"); } static void check(int idx, HashSet used, boolean[] firstOne) { if (idx == n) { output(firstOne); System.exit(0); } String one = strings[idx].substring(0, 1); String two = strings[idx].substring(1, 3); if (!used.contains(one) && !used.contains(two)) { firstOne[idx] = true; used.add(one); used.add(two); check(idx + 1, used, firstOne); used.remove(one); used.remove(two); } one = strings[idx].substring(0, 2); two = strings[idx].substring(2, 3); if (!used.contains(one) && !used.contains(two)) { firstOne[idx] = false; used.add(one); used.add(two); check(idx + 1, used, firstOne); used.remove(one); used.remove(two); } } static void output(boolean[] firstOne) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { if (firstOne[i]) { sb.append(strings[i].substring(0, 1)).append(" ").append(strings[i].substring(1, 3)); } else { sb.append(strings[i].substring(0, 2)).append(" ").append(strings[i].substring(2, 3)); } sb.append("\n"); } System.out.print(sb); } }