import java.util.*;
class Main {
    public static void main(String[]a)throws Exception {
        byte[]b=new byte[20000];System.in.read(b);
        String[]w=new String(b).split("\\s");
        int n=Integer.parseInt(w[0]),i,j;
        String r,x="",y=x,c=x;
        Arrays.sort(w,1,n+1);
        for(i=1;i<=n;i++){
            r=new StringBuffer(w[i]).reverse().toString();
            for(j=i+1;j<=n&&!r.equals(w[j]);j++);
            if(j<=n){x+=w[i];y=r+y;w[j]="";}else if(r.equals(w[i]))c+=r;
        }
        System.out.print(x+c+y);       
    }
}

@@ -12,17 +12,16 @@
 .util.*;
-%0A
 class Ma
@@ -22,23 +22,17 @@
 ass Main
- %7B%0A    
+%7B
 public s
@@ -61,266 +61,272 @@
 %5B%5Da)
-throws Exception %7B%0A        byte%5B%5Db=new byte%5B20000%5D;System.in.read(b);%0A        String%5B%5Dw=new String(b).split(%22%5C%5Cs%22);%0A        int n=Integer.parseInt(w%5B0%5D),i,j;%0A        String r,x=%22%22,y=x,c=x;%0A        Arrays.sort(w,1,n+1);%0A        for(i=1;i%3C=n;i++)%7B%0A            
+%7BScanner q=new Scanner(System.in);int m,n=q.nextInt();String r,c=%22%22;Map%3CString,Integer%3Ew=new HashMap();for(;n%3E0;n--)%7Br=q.next();if(w.containsKey(r))w.put(r,1+(int)w.get(r));else w.put(r,1);%7DStringBuffer s=new StringBuffer();for(String k:new TreeSet%3C%3E(w.keySet()))%7B
 r=ne
@@ -340,20 +340,17 @@
 gBuffer(
-w%5Bi%5D
+k
 ).revers
@@ -356,198 +356,214 @@
 se()
-.toString();%0A            for(j=i+1;j%3C=n&&!r.equals(w%5Bj%5D);j++);%0A            if(j%3C=n)%7Bx+=w%5Bi%5D;y=r+y;w%5Bj%5D=%22%22;%7Delse if(r.equals(w%5Bi%5D))c+=r;%0A        %7D%0A        System.out.print(x+c+y);       %0A    %7D%0A
++%22%22;if(!w.containsKey(r))continue;m=Math.min(w.get(k), w.get(r));w.put(k,0);if(k.equals(r))%7Bif(m%252==1&&(c.isEmpty()%7C%7Ck.compareTo(c)%3C0))c=k;m/=2;%7Dfor(;m%3E0;m--)s.append(k);%7DSystem.out.println(s+c+s.reverse());%7D
 %7D%0A

Revert "Update answer.java"