import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int givenLength = scanner.nextInt();
        scanner.nextLine();
        String[] array = new String[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        }
        Arrays.sort(array);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        }
        System.out.println(sb);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int givenLength = scanner.nextInt();
        scanner.nextLine();
        String[] array = new String[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        }
        Arrays.sort(array);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        }
        System.out.println(sb);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int givenLength = scanner.nextInt();
        scanner.nextLine();
        String[] array = new String[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        }
        Arrays.sort(array);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        }
        System.out.println(sb);
    } main {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int givenLength = scanner.nextInt();
        scanner.nextLine();
        String[] array = new String[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        }
        Arrays.sort(array);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        }
        System.out.println(sb);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int givenNumber = scanner.nextInt(); givenNumber scanner.nextInt() scanner.nextInt scanner int givenLength = scanner.nextInt(); givenLength scanner.nextInt() scanner.nextInt scanner scanner.nextLine() scanner.nextLine scanner String[] array = new String[givenNumber]; array new String[givenNumber] givenNumber for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        } int i=0; int i=0; i 0 i<givenNumber i givenNumber i++ i++ i {
            array[i] = scanner.nextLine();
        } {
            array[i] = scanner.nextLine();
        } array[i] = scanner.nextLine() array[i] array i scanner.nextLine() scanner.nextLine scanner Arrays.sort(array) Arrays.sort Arrays array StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        } int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
            sb.append(array[i]);
        } {
            sb.append(array[i]);
        } sb.append(array[i]) sb.append sb array[i] array i System.out.println(sb) System.out.println System.out System System.out sb String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int givenLength = scanner.nextInt();
        scanner.nextLine();
        String[] array = new String[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        }
        Arrays.sort(array);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        }
        System.out.println(sb);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int givenLength = scanner.nextInt();
        scanner.nextLine();
        String[] array = new String[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        }
        Arrays.sort(array);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        }
        System.out.println(sb);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int givenNumber = scanner.nextInt();
        int givenLength = scanner.nextInt();
        scanner.nextLine();
        String[] array = new String[givenNumber];
        for(int i=0; i<givenNumber; i++) {
            array[i] = scanner.nextLine();
        }
        Arrays.sort(array);
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<array.length; i++) {
            sb.append(array[i]);
        }
        System.out.println(sb);
    }
}
