import java.io.*;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inp = br.readLine().split(" ");
		String input = null;
		int n = Integer.parseInt(inp[0]);
		int l = Integer.parseInt(inp[1]);
		String[] in = new String[n];
		for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		}
		Arrays.sort(in);
		for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		}
		System.out.println();
	}

} import java.io.*; io.* java import java.util.Arrays; Arrays java.util public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inp = br.readLine().split(" ");
		String input = null;
		int n = Integer.parseInt(inp[0]);
		int l = Integer.parseInt(inp[1]);
		String[] in = new String[n];
		for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		}
		Arrays.sort(in);
		for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		}
		System.out.println();
	}

} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inp = br.readLine().split(" ");
		String input = null;
		int n = Integer.parseInt(inp[0]);
		int l = Integer.parseInt(inp[1]);
		String[] in = new String[n];
		for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		}
		Arrays.sort(in);
		for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		}
		System.out.println();
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inp = br.readLine().split(" ");
		String input = null;
		int n = Integer.parseInt(inp[0]);
		int l = Integer.parseInt(inp[1]);
		String[] in = new String[n];
		for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		}
		Arrays.sort(in);
		for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		}
		System.out.println();
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] inp = br.readLine().split(" "); inp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String input = null; input null int n = Integer.parseInt(inp[0]); n Integer.parseInt(inp[0]) Integer.parseInt Integer inp[0] inp 0 int l = Integer.parseInt(inp[1]); l Integer.parseInt(inp[1]) Integer.parseInt Integer inp[1] inp 1 String[] in = new String[n]; in new String[n] n for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			in[i] = br.readLine();
		} {
			in[i] = br.readLine();
		} in[i] = br.readLine() in[i] in i br.readLine() br.readLine br Arrays.sort(in) Arrays.sort Arrays in for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(in[i]);
		} {
			System.out.print(in[i]);
		} System.out.print(in[i]) System.out.print System.out System System.out in[i] in i System.out.println() System.out.println System.out System System.out String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inp = br.readLine().split(" ");
		String input = null;
		int n = Integer.parseInt(inp[0]);
		int l = Integer.parseInt(inp[1]);
		String[] in = new String[n];
		for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		}
		Arrays.sort(in);
		for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		}
		System.out.println();
	}

} public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inp = br.readLine().split(" ");
		String input = null;
		int n = Integer.parseInt(inp[0]);
		int l = Integer.parseInt(inp[1]);
		String[] in = new String[n];
		for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		}
		Arrays.sort(in);
		for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		}
		System.out.println();
	}

} Main
import java.io.*;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] inp = br.readLine().split(" ");
		String input = null;
		int n = Integer.parseInt(inp[0]);
		int l = Integer.parseInt(inp[1]);
		String[] in = new String[n];
		for (int i = 0; i < n; i++) {
			in[i] = br.readLine();
		}
		Arrays.sort(in);
		for (int i = 0; i < n; i++) {
			System.out.print(in[i]);
		}
		System.out.println();
	}

}