def main(): import sys input = sys.stdin.read().split() n = int(input[0]) us = input[1:n+1] used = set() result = [] for u in us: # Try split1: S is first character, T is the next two s1 = u[0] t1 = u[1:3] if s1 not in used and t1 not in used: result.append((s1, t1)) used.add(s1) used.add(t1) continue # Try split2: S is first two, T is last character s2 = u[:2] t2 = u[2] if s2 not in used and t2 not in used: result.append((s2, t2)) used.add(s2) used.add(t2) continue # Neither split works print("Impossible") return # Output the result for pair in result: print(f"{pair[0]} {pair[1]}") if __name__ == "__main__": main()