import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {

        Scanner inpunt = new Scanner(System.in);
        int x ,y ;
        String result="";
        x=inpunt.nextInt();
        y=inpunt.nextInt();
        inpunt.nextLine();
        String array[] = new String[x];
        for(int i=0;i<x;i++){
           array[i]=inpunt.nextLine();
        }

        Arrays.sort(array);

        for(int i=0;i<x;i++){
            result += array[i];
        }
        System.out.println(result);

    }
} import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {

        Scanner inpunt = new Scanner(System.in);
        int x ,y ;
        String result="";
        x=inpunt.nextInt();
        y=inpunt.nextInt();
        inpunt.nextLine();
        String array[] = new String[x];
        for(int i=0;i<x;i++){
           array[i]=inpunt.nextLine();
        }

        Arrays.sort(array);

        for(int i=0;i<x;i++){
            result += array[i];
        }
        System.out.println(result);

    }
} Main public static void main(String[] args) {

        Scanner inpunt = new Scanner(System.in);
        int x ,y ;
        String result="";
        x=inpunt.nextInt();
        y=inpunt.nextInt();
        inpunt.nextLine();
        String array[] = new String[x];
        for(int i=0;i<x;i++){
           array[i]=inpunt.nextLine();
        }

        Arrays.sort(array);

        for(int i=0;i<x;i++){
            result += array[i];
        }
        System.out.println(result);

    } main {

        Scanner inpunt = new Scanner(System.in);
        int x ,y ;
        String result="";
        x=inpunt.nextInt();
        y=inpunt.nextInt();
        inpunt.nextLine();
        String array[] = new String[x];
        for(int i=0;i<x;i++){
           array[i]=inpunt.nextLine();
        }

        Arrays.sort(array);

        for(int i=0;i<x;i++){
            result += array[i];
        }
        System.out.println(result);

    } Scanner inpunt = new Scanner(System.in); inpunt new Scanner(System.in) int x x y ; y String result=""; result "" x=inpunt.nextInt() x inpunt.nextInt() inpunt.nextInt inpunt y=inpunt.nextInt() y inpunt.nextInt() inpunt.nextInt inpunt inpunt.nextLine() inpunt.nextLine inpunt String array[] = new String[x]; array new String[x] x for(int i=0;i<x;i++){
           array[i]=inpunt.nextLine();
        } int i=0; int i=0; i 0 i<x i x i++ i++ i {
           array[i]=inpunt.nextLine();
        } {
           array[i]=inpunt.nextLine();
        } array[i]=inpunt.nextLine() array[i] array i inpunt.nextLine() inpunt.nextLine inpunt Arrays.sort(array) Arrays.sort Arrays array for(int i=0;i<x;i++){
            result += array[i];
        } int i=0; int i=0; i 0 i<x i x i++ i++ i {
            result += array[i];
        } {
            result += array[i];
        } result += array[i] result array[i] array i System.out.println(result) System.out.println System.out System System.out result String[] args args
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {

        Scanner inpunt = new Scanner(System.in);
        int x ,y ;
        String result="";
        x=inpunt.nextInt();
        y=inpunt.nextInt();
        inpunt.nextLine();
        String array[] = new String[x];
        for(int i=0;i<x;i++){
           array[i]=inpunt.nextLine();
        }

        Arrays.sort(array);

        for(int i=0;i<x;i++){
            result += array[i];
        }
        System.out.println(result);

    }
}