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);
	}

}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz