import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nl = scanner.nextLine().split(" ", 2);
        int n = Integer.parseInt(nl[0]);
        int l = Integer.parseInt(nl[1]);

        String[] arr = new String[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextLine();
        }
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            System.out.print(arr[i]);
        }
        System.out.print("\n");
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nl = scanner.nextLine().split(" ", 2);
        int n = Integer.parseInt(nl[0]);
        int l = Integer.parseInt(nl[1]);

        String[] arr = new String[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextLine();
        }
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            System.out.print(arr[i]);
        }
        System.out.print("\n");
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nl = scanner.nextLine().split(" ", 2);
        int n = Integer.parseInt(nl[0]);
        int l = Integer.parseInt(nl[1]);

        String[] arr = new String[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextLine();
        }
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            System.out.print(arr[i]);
        }
        System.out.print("\n");
    } main {
        Scanner scanner = new Scanner(System.in);
        String[] nl = scanner.nextLine().split(" ", 2);
        int n = Integer.parseInt(nl[0]);
        int l = Integer.parseInt(nl[1]);

        String[] arr = new String[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextLine();
        }
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            System.out.print(arr[i]);
        }
        System.out.print("\n");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String[] nl = scanner.nextLine().split(" ", 2); nl scanner.nextLine().split(" ", 2) scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " 2 int n = Integer.parseInt(nl[0]); n Integer.parseInt(nl[0]) Integer.parseInt Integer nl[0] nl 0 int l = Integer.parseInt(nl[1]); l Integer.parseInt(nl[1]) Integer.parseInt Integer nl[1] nl 1 String[] arr = new String[n]; arr new String[n] n for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextLine();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            arr[i] = scanner.nextLine();
        } {
            arr[i] = scanner.nextLine();
        } arr[i] = scanner.nextLine() arr[i] arr i scanner.nextLine() scanner.nextLine scanner Arrays.sort(arr) Arrays.sort Arrays arr for (int i = 0; i < n; i++) {
            System.out.print(arr[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            System.out.print(arr[i]);
        } {
            System.out.print(arr[i]);
        } System.out.print(arr[i]) System.out.print System.out System System.out arr[i] arr i System.out.print("\n") System.out.print System.out System System.out "\n" String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nl = scanner.nextLine().split(" ", 2);
        int n = Integer.parseInt(nl[0]);
        int l = Integer.parseInt(nl[1]);

        String[] arr = new String[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextLine();
        }
        Arrays.sort(arr);
        for (int i = 0; i < n; i++) {
            System.out.print(arr[i]);
        }
        System.out.print("\n");
    }
}
