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

public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    } main {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n n l; l n = in.nextInt() n in.nextInt() in.nextInt in l = in.nextInt() l in.nextInt() in.nextInt in in.nextLine() in.nextLine in String input; input String words[] = new String[n]; words new String[n] n for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        } int i =0; int i =0; i 0 i<n i n i++ i++ i {
            input = in.nextLine();
            words[i] = input;
        } {
            input = in.nextLine();
            words[i] = input;
        } input = in.nextLine() input in.nextLine() in.nextLine in words[i] = input words[i] words i input Arrays.sort(words) Arrays.sort Arrays words String joinedWord = String.join("",words); joinedWord String.join("",words) String.join String "" words System.out.println(joinedWord) System.out.println System.out System System.out joinedWord String[] args args public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    }
} public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    }
} Main

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

public class Main {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n, l;
        n = in.nextInt();
        l = in.nextInt();
        in.nextLine();
        String input;
        String words[] = new String[n];

        for (int i =0; i<n ;i++){
            input = in.nextLine();
            words[i] = input;
        }
        Arrays.sort(words);
        String joinedWord = String.join("",words);
        System.out.println(joinedWord);

    }
}