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



public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int leng = sc.nextInt(); leng sc.nextInt() sc.nextInt sc String[] input = new String[num]; input new String[num] num for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
			input[i] = sc.next();
		} {
			input[i] = sc.next();
		} input[i] = sc.next() input[i] input i sc.next() sc.next sc Arrays.sort(input) Arrays.sort Arrays input for(String result: input) {
			System.out.print(result);
		} String result input {
			System.out.print(result);
		} {
			System.out.print(result);
		} System.out.print(result) System.out.print System.out System System.out result String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	}

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



public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		int leng = sc.nextInt();
		String[] input = new String[num];
		for(int i = 0; i < num; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for(String result: input) {
			System.out.print(result);
		}
	}

}
