import java.util.Arrays;
import java.util.Scanner;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);

		StringBuilder sb = new StringBuilder();
		for (String s : S) {
			sb.append(s);
		}
		System.out.println(sb.toString());

	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);

		StringBuilder sb = new StringBuilder();
		for (String s : S) {
			sb.append(s);
		}
		System.out.println(sb.toString());

	}
} Solver static final Solver INSTANCE = new Solver(); INSTANCE new Solver() void solve(Scanner sc) {
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);

		StringBuilder sb = new StringBuilder();
		for (String s : S) {
			sb.append(s);
		}
		System.out.println(sb.toString());

	} solve {
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);

		StringBuilder sb = new StringBuilder();
		for (String s : S) {
			sb.append(s);
		}
		System.out.println(sb.toString());

	} int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc String[] S = new String[N]; S new String[N] N for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			S[i] = sc.next();
		} {
			S[i] = sc.next();
		} S[i] = sc.next() S[i] S i sc.next() sc.next sc Arrays.sort(S) Arrays.sort Arrays S StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (String s : S) {
			sb.append(s);
		} String s S {
			sb.append(s);
		} {
			sb.append(s);
		} sb.append(s) sb.append sb s System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb Scanner sc sc class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
} Main public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	} main {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) Solver.INSTANCE.solve(in) Solver.INSTANCE.solve Solver.INSTANCE Solver Solver.INSTANCE in in.close() in.close in String... args args
import java.util.Arrays;
import java.util.Scanner;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] S = new String[N];
		for (int i = 0; i < N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);

		StringBuilder sb = new StringBuilder();
		for (String s : S) {
			sb.append(s);
		}
		System.out.println(sb.toString());

	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}