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) {
		new Main().solve();
		return;
	}

	private void solve() {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		List<String> S = new ArrayList<String>();
		for (int i = 0; i < N; i++) {
			S.add(sc.next());
		}
		sc.close();

		// 計算
		Collections.sort(S);
		StringBuffer sb = new StringBuffer(N * L + 1);
		for (String string : S) {
			sb.append(string);
		}

		// 出力
		System.out.println(sb.toString());

		return;
	}
} 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) {
		new Main().solve();
		return;
	}

	private void solve() {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		List<String> S = new ArrayList<String>();
		for (int i = 0; i < N; i++) {
			S.add(sc.next());
		}
		sc.close();

		// 計算
		Collections.sort(S);
		StringBuffer sb = new StringBuffer(N * L + 1);
		for (String string : S) {
			sb.append(string);
		}

		// 出力
		System.out.println(sb.toString());

		return;
	}
} Main public static void main(String[] args) {
		new Main().solve();
		return;
	} main {
		new Main().solve();
		return;
	} new Main().solve() new Main().solve new Main() return; String[] args args private void solve() {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		List<String> S = new ArrayList<String>();
		for (int i = 0; i < N; i++) {
			S.add(sc.next());
		}
		sc.close();

		// 計算
		Collections.sort(S);
		StringBuffer sb = new StringBuffer(N * L + 1);
		for (String string : S) {
			sb.append(string);
		}

		// 出力
		System.out.println(sb.toString());

		return;
	} solve {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		List<String> S = new ArrayList<String>();
		for (int i = 0; i < N; i++) {
			S.add(sc.next());
		}
		sc.close();

		// 計算
		Collections.sort(S);
		StringBuffer sb = new StringBuffer(N * L + 1);
		for (String string : S) {
			sb.append(string);
		}

		// 出力
		System.out.println(sb.toString());

		return;
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc List<String> S = new ArrayList<String>(); S new ArrayList<String>() for (int i = 0; i < N; i++) {
			S.add(sc.next());
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			S.add(sc.next());
		} {
			S.add(sc.next());
		} S.add(sc.next()) S.add S sc.next() sc.next sc sc.close() sc.close sc Collections.sort(S) Collections.sort Collections S StringBuffer sb = new StringBuffer(N * L + 1); sb new StringBuffer(N * L + 1) for (String string : S) {
			sb.append(string);
		} String string S {
			sb.append(string);
		} {
			sb.append(string);
		} sb.append(string) sb.append sb string System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb return; public class Main {
	public static void main(String[] args) {
		new Main().solve();
		return;
	}

	private void solve() {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		List<String> S = new ArrayList<String>();
		for (int i = 0; i < N; i++) {
			S.add(sc.next());
		}
		sc.close();

		// 計算
		Collections.sort(S);
		StringBuffer sb = new StringBuffer(N * L + 1);
		for (String string : S) {
			sb.append(string);
		}

		// 出力
		System.out.println(sb.toString());

		return;
	}
} public class Main {
	public static void main(String[] args) {
		new Main().solve();
		return;
	}

	private void solve() {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		List<String> S = new ArrayList<String>();
		for (int i = 0; i < N; i++) {
			S.add(sc.next());
		}
		sc.close();

		// 計算
		Collections.sort(S);
		StringBuffer sb = new StringBuffer(N * L + 1);
		for (String string : S) {
			sb.append(string);
		}

		// 出力
		System.out.println(sb.toString());

		return;
	}
} 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) {
		new Main().solve();
		return;
	}

	private void solve() {
		// 入力
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		List<String> S = new ArrayList<String>();
		for (int i = 0; i < N; i++) {
			S.add(sc.next());
		}
		sc.close();

		// 計算
		Collections.sort(S);
		StringBuffer sb = new StringBuffer(N * L + 1);
		for (String string : S) {
			sb.append(string);
		}

		// 出力
		System.out.println(sb.toString());

		return;
	}
}
