using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ if(N > 52){ Console.WriteLine("Impossible"); return; } HashSet<String> one = new HashSet<String>(); HashSet<String> two = new HashSet<String>(); for(int i=0;i<N;i++){ one.Add(S[i].Substring(0,1)); one.Add(S[i].Substring(2)); two.Add(S[i].Substring(0,2)); two.Add(S[i].Substring(1)); } if(one.Count<N || two.Count<N){ Console.WriteLine("Impossible"); return; } String[] S0 = new String[N]; for(int i=0;i<N;i++)S0[i] = S[i]; int[] ord = Enumerable.Range(0,N).ToArray(); Array.Sort(S,ord); h = new HashSet<String>(); found = false; route = new int[N]; dfs(0); if(!found){ Console.WriteLine("Impossible"); return; } Array.Sort(ord,ans); for(int i=0;i<N;i++){ Console.WriteLine("{0} {1}",S0[i].Substring(0,ans[i]),S0[i].Substring(ans[i])); } } Stopwatch sw; bool found; int[] route; int[] ans; HashSet<String> h; void dfs(int now){ if(found) return; if(sw.ElapsedMilliseconds >= 1800) return; if(now == N){ found = true; ans = new int[N]; for(int i=0;i<N;i++) ans[i] = route[i]; return; } for(int j=1;j<=2;j++){ var s0 = S[now].Substring(0,j); var s1 = S[now].Substring(j); if(!h.Contains(s0) && !h.Contains(s1)){ h.Add(s0); h.Add(s1); route[now] = j; dfs(now+1); route[now] = 0; h.Remove(s0); h.Remove(s1); } } } int N; String[] S; public Sol(){ sw = new Stopwatch(); sw.Start(); N = ri(); S = new String[N]; for(int i=0;i<N;i++) S[i] = rs(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }