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

public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        int n=s.nextInt();
        s.nextLine();
        String[] arr=new String[t];
        for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        }
        Arrays.sort(arr);
        StringBuilder str=new StringBuilder();
        for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        }
        System.out.println(str);

    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        int n=s.nextInt();
        s.nextLine();
        String[] arr=new String[t];
        for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        }
        Arrays.sort(arr);
        StringBuilder str=new StringBuilder();
        for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        }
        System.out.println(str);

    }
} Main public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        int n=s.nextInt();
        s.nextLine();
        String[] arr=new String[t];
        for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        }
        Arrays.sort(arr);
        StringBuilder str=new StringBuilder();
        for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        }
        System.out.println(str);

    } main {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        int n=s.nextInt();
        s.nextLine();
        String[] arr=new String[t];
        for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        }
        Arrays.sort(arr);
        StringBuilder str=new StringBuilder();
        for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        }
        System.out.println(str);

    } Scanner s=new Scanner(System.in); s new Scanner(System.in) int t=s.nextInt(); t s.nextInt() s.nextInt s int n=s.nextInt(); n s.nextInt() s.nextInt s s.nextLine() s.nextLine s String[] arr=new String[t]; arr new String[t] t for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        } int i=0; int i=0; i 0 i<t i t i++ i++ i {
            arr[i]=s.nextLine();
        } {
            arr[i]=s.nextLine();
        } arr[i]=s.nextLine() arr[i] arr i s.nextLine() s.nextLine s Arrays.sort(arr) Arrays.sort Arrays arr StringBuilder str=new StringBuilder(); str new StringBuilder() for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        } int i=0; int i=0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {
            str.append(arr[i]);
        } {
            str.append(arr[i]);
        } str.append(arr[i]) str.append str arr[i] arr i System.out.println(str) System.out.println System.out System System.out str String[] args args public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        int n=s.nextInt();
        s.nextLine();
        String[] arr=new String[t];
        for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        }
        Arrays.sort(arr);
        StringBuilder str=new StringBuilder();
        for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        }
        System.out.println(str);

    }
} public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        int n=s.nextInt();
        s.nextLine();
        String[] arr=new String[t];
        for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        }
        Arrays.sort(arr);
        StringBuilder str=new StringBuilder();
        for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        }
        System.out.println(str);

    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        int n=s.nextInt();
        s.nextLine();
        String[] arr=new String[t];
        for(int i=0;i<t;i++){
            arr[i]=s.nextLine();
        }
        Arrays.sort(arr);
        StringBuilder str=new StringBuilder();
        for(int i=0;i<arr.length;i++){
            str.append(arr[i]);
        }
        System.out.println(str);

    }
}
