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 in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();
		List<String> arrayList = new ArrayList<>();
		in.nextLine();
		for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		}
		in.close();
		Collections.sort(arrayList);
		for(String e : arrayList) {
			System.out.print(e);
		}

	}
} 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 in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();
		List<String> arrayList = new ArrayList<>();
		in.nextLine();
		for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		}
		in.close();
		Collections.sort(arrayList);
		for(String e : arrayList) {
			System.out.print(e);
		}

	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();
		List<String> arrayList = new ArrayList<>();
		in.nextLine();
		for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		}
		in.close();
		Collections.sort(arrayList);
		for(String e : arrayList) {
			System.out.print(e);
		}

	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();
		List<String> arrayList = new ArrayList<>();
		in.nextLine();
		for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		}
		in.close();
		Collections.sort(arrayList);
		for(String e : arrayList) {
			System.out.print(e);
		}

	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int l = in.nextInt(); l in.nextInt() in.nextInt in List<String> arrayList = new ArrayList<>(); arrayList new ArrayList<>() in.nextLine() in.nextLine in for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arrayList.add(in.nextLine());
		} {
			arrayList.add(in.nextLine());
		} arrayList.add(in.nextLine()) arrayList.add arrayList in.nextLine() in.nextLine in in.close() in.close in Collections.sort(arrayList) Collections.sort Collections arrayList for(String e : arrayList) {
			System.out.print(e);
		} String e arrayList {
			System.out.print(e);
		} {
			System.out.print(e);
		} System.out.print(e) System.out.print System.out System System.out e String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();
		List<String> arrayList = new ArrayList<>();
		in.nextLine();
		for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		}
		in.close();
		Collections.sort(arrayList);
		for(String e : arrayList) {
			System.out.print(e);
		}

	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();
		List<String> arrayList = new ArrayList<>();
		in.nextLine();
		for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		}
		in.close();
		Collections.sort(arrayList);
		for(String e : arrayList) {
			System.out.print(e);
		}

	}
} 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 in = new Scanner(System.in);
		int n = in.nextInt();
		int l = in.nextInt();
		List<String> arrayList = new ArrayList<>();
		in.nextLine();
		for(int i = 0; i < n;i++) {
			arrayList.add(in.nextLine());
		}
		in.close();
		Collections.sort(arrayList);
		for(String e : arrayList) {
			System.out.print(e);
		}

	}
}