import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numL = scan.nextInt();

		ArrayList<String> strS = new ArrayList<>();

		for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		}

		Collections.sort(strS);

		StringBuilder strSB = new StringBuilder();

		for (String str : strS) {
			strSB.append(str);
		}
		System.out.println(strSB);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numL = scan.nextInt();

		ArrayList<String> strS = new ArrayList<>();

		for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		}

		Collections.sort(strS);

		StringBuilder strSB = new StringBuilder();

		for (String str : strS) {
			strSB.append(str);
		}
		System.out.println(strSB);
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numL = scan.nextInt();

		ArrayList<String> strS = new ArrayList<>();

		for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		}

		Collections.sort(strS);

		StringBuilder strSB = new StringBuilder();

		for (String str : strS) {
			strSB.append(str);
		}
		System.out.println(strSB);
	} main {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numL = scan.nextInt();

		ArrayList<String> strS = new ArrayList<>();

		for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		}

		Collections.sort(strS);

		StringBuilder strSB = new StringBuilder();

		for (String str : strS) {
			strSB.append(str);
		}
		System.out.println(strSB);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int numN = scan.nextInt(); numN scan.nextInt() scan.nextInt scan int numL = scan.nextInt(); numL scan.nextInt() scan.nextInt scan ArrayList<String> strS = new ArrayList<>(); strS new ArrayList<>() for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		} int i = 0; int i = 0; i 0 i < numN i numN i++ i++ i {
			strS.add(scan.next());
		} {
			strS.add(scan.next());
		} strS.add(scan.next()) strS.add strS scan.next() scan.next scan Collections.sort(strS) Collections.sort Collections strS StringBuilder strSB = new StringBuilder(); strSB new StringBuilder() for (String str : strS) {
			strSB.append(str);
		} String str strS {
			strSB.append(str);
		} {
			strSB.append(str);
		} strSB.append(str) strSB.append strSB str System.out.println(strSB) System.out.println System.out System System.out strSB String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numL = scan.nextInt();

		ArrayList<String> strS = new ArrayList<>();

		for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		}

		Collections.sort(strS);

		StringBuilder strSB = new StringBuilder();

		for (String str : strS) {
			strSB.append(str);
		}
		System.out.println(strSB);
	}
} public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numL = scan.nextInt();

		ArrayList<String> strS = new ArrayList<>();

		for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		}

		Collections.sort(strS);

		StringBuilder strSB = new StringBuilder();

		for (String str : strS) {
			strSB.append(str);
		}
		System.out.println(strSB);
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int numN = scan.nextInt();
		int numL = scan.nextInt();

		ArrayList<String> strS = new ArrayList<>();

		for (int i = 0; i < numN; i++) {
			strS.add(scan.next());
		}

		Collections.sort(strS);

		StringBuilder strSB = new StringBuilder();

		for (String str : strS) {
			strSB.append(str);
		}
		System.out.println(strSB);
	}
}
