import java.util.*;
public class Main {

 public static void main(String[] args) {
   Scanner no=new Scanner(System.in);
   int n=no.nextInt();
   StringBuilder sb=new StringBuilder();
   String arr[]=new String[n];
   int m=no.nextInt();
   for(int i=0;i<n;i++){
     arr[i]=no.next();
   }
   Arrays.sort(arr);
   for(int i=0;i<n;i++){
     sb.append(arr[i]);
   }
   System.out.println(sb.toString());
  }

}
  import java.util.*; util.* java public class Main {

 public static void main(String[] args) {
   Scanner no=new Scanner(System.in);
   int n=no.nextInt();
   StringBuilder sb=new StringBuilder();
   String arr[]=new String[n];
   int m=no.nextInt();
   for(int i=0;i<n;i++){
     arr[i]=no.next();
   }
   Arrays.sort(arr);
   for(int i=0;i<n;i++){
     sb.append(arr[i]);
   }
   System.out.println(sb.toString());
  }

} Main public static void main(String[] args) {
   Scanner no=new Scanner(System.in);
   int n=no.nextInt();
   StringBuilder sb=new StringBuilder();
   String arr[]=new String[n];
   int m=no.nextInt();
   for(int i=0;i<n;i++){
     arr[i]=no.next();
   }
   Arrays.sort(arr);
   for(int i=0;i<n;i++){
     sb.append(arr[i]);
   }
   System.out.println(sb.toString());
  } main {
   Scanner no=new Scanner(System.in);
   int n=no.nextInt();
   StringBuilder sb=new StringBuilder();
   String arr[]=new String[n];
   int m=no.nextInt();
   for(int i=0;i<n;i++){
     arr[i]=no.next();
   }
   Arrays.sort(arr);
   for(int i=0;i<n;i++){
     sb.append(arr[i]);
   }
   System.out.println(sb.toString());
  } Scanner no=new Scanner(System.in); no new Scanner(System.in) int n=no.nextInt(); n no.nextInt() no.nextInt no StringBuilder sb=new StringBuilder(); sb new StringBuilder() String arr[]=new String[n]; arr new String[n] n int m=no.nextInt(); m no.nextInt() no.nextInt no for(int i=0;i<n;i++){
     arr[i]=no.next();
   } int i=0; int i=0; i 0 i<n i n i++ i++ i {
     arr[i]=no.next();
   } {
     arr[i]=no.next();
   } arr[i]=no.next() arr[i] arr i no.next() no.next no Arrays.sort(arr) Arrays.sort Arrays arr for(int i=0;i<n;i++){
     sb.append(arr[i]);
   } int i=0; int i=0; i 0 i<n i n i++ i++ i {
     sb.append(arr[i]);
   } {
     sb.append(arr[i]);
   } sb.append(arr[i]) sb.append sb arr[i] arr i System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {

 public static void main(String[] args) {
   Scanner no=new Scanner(System.in);
   int n=no.nextInt();
   StringBuilder sb=new StringBuilder();
   String arr[]=new String[n];
   int m=no.nextInt();
   for(int i=0;i<n;i++){
     arr[i]=no.next();
   }
   Arrays.sort(arr);
   for(int i=0;i<n;i++){
     sb.append(arr[i]);
   }
   System.out.println(sb.toString());
  }

} public class Main {

 public static void main(String[] args) {
   Scanner no=new Scanner(System.in);
   int n=no.nextInt();
   StringBuilder sb=new StringBuilder();
   String arr[]=new String[n];
   int m=no.nextInt();
   for(int i=0;i<n;i++){
     arr[i]=no.next();
   }
   Arrays.sort(arr);
   for(int i=0;i<n;i++){
     sb.append(arr[i]);
   }
   System.out.println(sb.toString());
  }

} Main
import java.util.*;
public class Main {

 public static void main(String[] args) {
   Scanner no=new Scanner(System.in);
   int n=no.nextInt();
   StringBuilder sb=new StringBuilder();
   String arr[]=new String[n];
   int m=no.nextInt();
   for(int i=0;i<n;i++){
     arr[i]=no.next();
   }
   Arrays.sort(arr);
   for(int i=0;i<n;i++){
     sb.append(arr[i]);
   }
   System.out.println(sb.toString());
  }

}
 