import java.util.*;


class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        List<String> array = new ArrayList<String>();
        int i = 0;

        while(i<=a){
          String c = scan.nextLine();
          array.add(c);
          i++;  
        }
        Collections.sort(array);
        i = 0;
        while(i<=a){
            System.out.print(array.get(i));
            i++;  
          }
        scan.close();
    }
} import java.util.*; util.* java class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        List<String> array = new ArrayList<String>();
        int i = 0;

        while(i<=a){
          String c = scan.nextLine();
          array.add(c);
          i++;  
        }
        Collections.sort(array);
        i = 0;
        while(i<=a){
            System.out.print(array.get(i));
            i++;  
          }
        scan.close();
    }
} Main public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        List<String> array = new ArrayList<String>();
        int i = 0;

        while(i<=a){
          String c = scan.nextLine();
          array.add(c);
          i++;  
        }
        Collections.sort(array);
        i = 0;
        while(i<=a){
            System.out.print(array.get(i));
            i++;  
          }
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        List<String> array = new ArrayList<String>();
        int i = 0;

        while(i<=a){
          String c = scan.nextLine();
          array.add(c);
          i++;  
        }
        Collections.sort(array);
        i = 0;
        while(i<=a){
            System.out.print(array.get(i));
            i++;  
          }
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan List<String> array = new ArrayList<String>(); array new ArrayList<String>() int i = 0; i 0 while(i<=a){
          String c = scan.nextLine();
          array.add(c);
          i++;  
        } i<=a i a {
          String c = scan.nextLine();
          array.add(c);
          i++;  
        } String c = scan.nextLine(); c scan.nextLine() scan.nextLine scan array.add(c) array.add array c i++ i Collections.sort(array) Collections.sort Collections array i = 0 i 0 while(i<=a){
            System.out.print(array.get(i));
            i++;  
          } i<=a i a {
            System.out.print(array.get(i));
            i++;  
          } System.out.print(array.get(i)) System.out.print System.out System System.out array.get(i) array.get array i i++ i scan.close() scan.close scan String args[] args
import java.util.*;


class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        List<String> array = new ArrayList<String>();
        int i = 0;

        while(i<=a){
          String c = scan.nextLine();
          array.add(c);
          i++;  
        }
        Collections.sort(array);
        i = 0;
        while(i<=a){
            System.out.print(array.get(i));
            i++;  
          }
        scan.close();
    }
}