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

public class Main {

	public static void main(String[] args) {


		//文字の個数
		int quantity = 0;
		//１文字の長さ
		int length = 0;
		String anser = "";

		Scanner scan = new Scanner(System.in);

        quantity = scan.nextInt();
        length = scan.nextInt();

		//入力された文字を入れる配列
		String[] str = new String[quantity];

		for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		}

		Arrays.sort(str);
		for(String s:str) {
			anser = anser + s;
		}

		System.out.println(anser);
	}

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

	public static void main(String[] args) {


		//文字の個数
		int quantity = 0;
		//１文字の長さ
		int length = 0;
		String anser = "";

		Scanner scan = new Scanner(System.in);

        quantity = scan.nextInt();
        length = scan.nextInt();

		//入力された文字を入れる配列
		String[] str = new String[quantity];

		for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		}

		Arrays.sort(str);
		for(String s:str) {
			anser = anser + s;
		}

		System.out.println(anser);
	}

} Main public static void main(String[] args) {


		//文字の個数
		int quantity = 0;
		//１文字の長さ
		int length = 0;
		String anser = "";

		Scanner scan = new Scanner(System.in);

        quantity = scan.nextInt();
        length = scan.nextInt();

		//入力された文字を入れる配列
		String[] str = new String[quantity];

		for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		}

		Arrays.sort(str);
		for(String s:str) {
			anser = anser + s;
		}

		System.out.println(anser);
	} main {


		//文字の個数
		int quantity = 0;
		//１文字の長さ
		int length = 0;
		String anser = "";

		Scanner scan = new Scanner(System.in);

        quantity = scan.nextInt();
        length = scan.nextInt();

		//入力された文字を入れる配列
		String[] str = new String[quantity];

		for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		}

		Arrays.sort(str);
		for(String s:str) {
			anser = anser + s;
		}

		System.out.println(anser);
	} int quantity = 0; quantity 0 int length = 0; length 0 String anser = ""; anser "" Scanner scan = new Scanner(System.in); scan new Scanner(System.in) quantity = scan.nextInt() quantity scan.nextInt() scan.nextInt scan length = scan.nextInt() length scan.nextInt() scan.nextInt scan String[] str = new String[quantity]; str new String[quantity] quantity for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		} int i = 0; int i = 0; i 0 i<quantity i quantity i++ i++ i {
			str[i] = scan.next();
		} {
			str[i] = scan.next();
		} str[i] = scan.next() str[i] str i scan.next() scan.next scan Arrays.sort(str) Arrays.sort Arrays str for(String s:str) {
			anser = anser + s;
		} String s str {
			anser = anser + s;
		} {
			anser = anser + s;
		} anser = anser + s anser anser + s anser s System.out.println(anser) System.out.println System.out System System.out anser String[] args args public class Main {

	public static void main(String[] args) {


		//文字の個数
		int quantity = 0;
		//１文字の長さ
		int length = 0;
		String anser = "";

		Scanner scan = new Scanner(System.in);

        quantity = scan.nextInt();
        length = scan.nextInt();

		//入力された文字を入れる配列
		String[] str = new String[quantity];

		for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		}

		Arrays.sort(str);
		for(String s:str) {
			anser = anser + s;
		}

		System.out.println(anser);
	}

} public class Main {

	public static void main(String[] args) {


		//文字の個数
		int quantity = 0;
		//１文字の長さ
		int length = 0;
		String anser = "";

		Scanner scan = new Scanner(System.in);

        quantity = scan.nextInt();
        length = scan.nextInt();

		//入力された文字を入れる配列
		String[] str = new String[quantity];

		for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		}

		Arrays.sort(str);
		for(String s:str) {
			anser = anser + s;
		}

		System.out.println(anser);
	}

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

public class Main {

	public static void main(String[] args) {


		//文字の個数
		int quantity = 0;
		//１文字の長さ
		int length = 0;
		String anser = "";

		Scanner scan = new Scanner(System.in);

        quantity = scan.nextInt();
        length = scan.nextInt();

		//入力された文字を入れる配列
		String[] str = new String[quantity];

		for(int i = 0;i<quantity;i++) {
			str[i] = scan.next();
		}

		Arrays.sort(str);
		for(String s:str) {
			anser = anser + s;
		}

		System.out.println(anser);
	}

}
