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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "";
		List<String> list = new ArrayList<>();
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		for (String s : list) {
			str += s;
		}
		System.out.println(str);
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "";
		List<String> list = new ArrayList<>();
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		for (String s : list) {
			str += s;
		}
		System.out.println(str);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "";
		List<String> list = new ArrayList<>();
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		for (String s : list) {
			str += s;
		}
		System.out.println(str);
	} main {
		Scanner sc = new Scanner(System.in);
		String str = "";
		List<String> list = new ArrayList<>();
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		for (String s : list) {
			str += s;
		}
		System.out.println(str);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = ""; str "" List<String> list = new ArrayList<>(); list new ArrayList<>() int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc for (int i = 0; i < a; i++) {
			list.add(sc.next());
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			list.add(sc.next());
		} {
			list.add(sc.next());
		} list.add(sc.next()) list.add list sc.next() sc.next sc Collections.sort(list) Collections.sort Collections list for (String s : list) {
			str += s;
		} String s list {
			str += s;
		} {
			str += s;
		} str += s str s System.out.println(str) System.out.println System.out System System.out str String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "";
		List<String> list = new ArrayList<>();
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		for (String s : list) {
			str += s;
		}
		System.out.println(str);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "";
		List<String> list = new ArrayList<>();
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		for (String s : list) {
			str += s;
		}
		System.out.println(str);
	}

} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "";
		List<String> list = new ArrayList<>();
		int a = sc.nextInt();
		int b = sc.nextInt();
		for (int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		for (String s : list) {
			str += s;
		}
		System.out.println(str);
	}

}
