import java.util.*;

class Main{
	public static void main(String args []){
    Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int l = scan.nextInt();
      String [] ss = new String[n];
      int i=0;
      while(i<n)
      {
        ss[i]=scan.next();
        i++;
      }
      Arrays.sort(ss);
      String res = "";
      for(String s:ss){
      	res+=s;
      }
      
      System.out.println(res);
    }
} import java.util.*; util.* java class Main{
	public static void main(String args []){
    Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int l = scan.nextInt();
      String [] ss = new String[n];
      int i=0;
      while(i<n)
      {
        ss[i]=scan.next();
        i++;
      }
      Arrays.sort(ss);
      String res = "";
      for(String s:ss){
      	res+=s;
      }
      
      System.out.println(res);
    }
} Main public static void main(String args []){
    Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int l = scan.nextInt();
      String [] ss = new String[n];
      int i=0;
      while(i<n)
      {
        ss[i]=scan.next();
        i++;
      }
      Arrays.sort(ss);
      String res = "";
      for(String s:ss){
      	res+=s;
      }
      
      System.out.println(res);
    } main {
    Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int l = scan.nextInt();
      String [] ss = new String[n];
      int i=0;
      while(i<n)
      {
        ss[i]=scan.next();
        i++;
      }
      Arrays.sort(ss);
      String res = "";
      for(String s:ss){
      	res+=s;
      }
      
      System.out.println(res);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int l = scan.nextInt(); l scan.nextInt() scan.nextInt scan String [] ss = new String[n]; ss new String[n] n int i=0; i 0 while(i<n)
      {
        ss[i]=scan.next();
        i++;
      } i<n i n {
        ss[i]=scan.next();
        i++;
      } ss[i]=scan.next() ss[i] ss i scan.next() scan.next scan i++ i Arrays.sort(ss) Arrays.sort Arrays ss String res = ""; res "" for(String s:ss){
      	res+=s;
      } String s ss {
      	res+=s;
      } {
      	res+=s;
      } res+=s res s System.out.println(res) System.out.println System.out System System.out res String args [] args
import java.util.*;

class Main{
	public static void main(String args []){
    Scanner scan = new Scanner(System.in);
      int n = scan.nextInt();
      int l = scan.nextInt();
      String [] ss = new String[n];
      int i=0;
      while(i<n)
      {
        ss[i]=scan.next();
        i++;
      }
      Arrays.sort(ss);
      String res = "";
      for(String s:ss){
      	res+=s;
      }
      
      System.out.println(res);
    }
}