import java.util.*;
import java.io.*;

public class Main{

     public static void main(String []args){
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<String> list = new ArrayList<>();
        
        for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        }
       
       Collections.sort(list);
       
        for(int i=0;i<list.size();i++)
        System.out.print(list.get(i));
       
     }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{

     public static void main(String []args){
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<String> list = new ArrayList<>();
        
        for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        }
       
       Collections.sort(list);
       
        for(int i=0;i<list.size();i++)
        System.out.print(list.get(i));
       
     }
} Main public static void main(String []args){
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<String> list = new ArrayList<>();
        
        for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        }
       
       Collections.sort(list);
       
        for(int i=0;i<list.size();i++)
        System.out.print(list.get(i));
       
     } main {
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<String> list = new ArrayList<>();
        
        for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        }
       
       Collections.sort(list);
       
        for(int i=0;i<list.size();i++)
        System.out.print(list.get(i));
       
     } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n1= scanner.nextInt(); n1 scanner.nextInt() scanner.nextInt scanner int n2= scanner.nextInt(); n2 scanner.nextInt() scanner.nextInt scanner List<String> list = new ArrayList<>(); list new ArrayList<>() for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        } int i=0; int i=0; i 0 i<n1 i n1 i++ i++ i {
          list.add(scanner.next());  
        } {
          list.add(scanner.next());  
        } list.add(scanner.next()) list.add list scanner.next() scanner.next scanner Collections.sort(list) Collections.sort Collections list for(int i=0;i<list.size();i++)
        System.out.print(list.get(i)); int i=0; int i=0; i 0 i<list.size() i list.size() list.size list i++ i++ i System.out.print(list.get(i)); System.out.print(list.get(i)) System.out.print System.out System System.out list.get(i) list.get list i String []args args public class Main{

     public static void main(String []args){
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<String> list = new ArrayList<>();
        
        for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        }
       
       Collections.sort(list);
       
        for(int i=0;i<list.size();i++)
        System.out.print(list.get(i));
       
     }
} public class Main{

     public static void main(String []args){
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<String> list = new ArrayList<>();
        
        for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        }
       
       Collections.sort(list);
       
        for(int i=0;i<list.size();i++)
        System.out.print(list.get(i));
       
     }
} Main
import java.util.*;
import java.io.*;

public class Main{

     public static void main(String []args){
       Scanner scanner = new Scanner(System.in);
       int n1= scanner.nextInt();
        int n2= scanner.nextInt();
        List<String> list = new ArrayList<>();
        
        for(int i=0;i<n1;i++)
        {
          list.add(scanner.next());  
        }
       
       Collections.sort(list);
       
        for(int i=0;i<list.size();i++)
        System.out.print(list.get(i));
       
     }
}