n = int(input()) used = set() result = [] possible = True for _ in range(n): u = input().strip() s1, t1 = u[0], u[1:] s2, t2 = u[:2], u[2] # Check first split possibility if s1 not in used and t1 not in used: used.add(s1) used.add(t1) result.append(f"{s1} {t1}") else: # Check second split possibility if s2 not in used and t2 not in used: used.add(s2) used.add(t2) result.append(f"{s2} {t2}") else: possible = False break if possible: print('\n'.join(result)) else: print("Impossible")