import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int l = parseInt(sc.next());
		String[] s = new String[n];
		for (i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		sc.close();
		Arrays.parallelSort(s);
		StringBuilder sb = new StringBuilder(s[0]);
		for (i = 1; i < n; i++) {
			sb.append(s[i]);
		}
		out.println(sb.toString());
	}
} import java.util.*; util.* java import java.io.PrintWriter; PrintWriter java.io import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int l = parseInt(sc.next());
		String[] s = new String[n];
		for (i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		sc.close();
		Arrays.parallelSort(s);
		StringBuilder sb = new StringBuilder(s[0]);
		for (i = 1; i < n; i++) {
			sb.append(s[i]);
		}
		out.println(sb.toString());
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int l = parseInt(sc.next());
		String[] s = new String[n];
		for (i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		sc.close();
		Arrays.parallelSort(s);
		StringBuilder sb = new StringBuilder(s[0]);
		for (i = 1; i < n; i++) {
			sb.append(s[i]);
		}
		out.println(sb.toString());
	} main {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int l = parseInt(sc.next());
		String[] s = new String[n];
		for (i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		sc.close();
		Arrays.parallelSort(s);
		StringBuilder sb = new StringBuilder(s[0]);
		for (i = 1; i < n; i++) {
			sb.append(s[i]);
		}
		out.println(sb.toString());
	} int i i j; j Scanner sc = new Scanner(in); sc new Scanner(in) int n = parseInt(sc.next()); n parseInt(sc.next()) parseInt sc.next() sc.next sc int l = parseInt(sc.next()); l parseInt(sc.next()) parseInt sc.next() sc.next sc String[] s = new String[n]; s new String[n] n for (i = 0; i < n; i++) {
			s[i] = sc.next();
		} i = 0; 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 sc.close() sc.close sc Arrays.parallelSort(s) Arrays.parallelSort Arrays s StringBuilder sb = new StringBuilder(s[0]); sb new StringBuilder(s[0]) for (i = 1; i < n; i++) {
			sb.append(s[i]);
		} i = 1; i = 1 i 1 i < n i n i++ i++ i {
			sb.append(s[i]);
		} {
			sb.append(s[i]);
		} sb.append(s[i]) sb.append sb s[i] s i out.println(sb.toString()) out.println out sb.toString() sb.toString sb String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int l = parseInt(sc.next());
		String[] s = new String[n];
		for (i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		sc.close();
		Arrays.parallelSort(s);
		StringBuilder sb = new StringBuilder(s[0]);
		for (i = 1; i < n; i++) {
			sb.append(s[i]);
		}
		out.println(sb.toString());
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int l = parseInt(sc.next());
		String[] s = new String[n];
		for (i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		sc.close();
		Arrays.parallelSort(s);
		StringBuilder sb = new StringBuilder(s[0]);
		for (i = 1; i < n; i++) {
			sb.append(s[i]);
		}
		out.println(sb.toString());
	}
} Main
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int l = parseInt(sc.next());
		String[] s = new String[n];
		for (i = 0; i < n; i++) {
			s[i] = sc.next();
		}
		sc.close();
		Arrays.parallelSort(s);
		StringBuilder sb = new StringBuilder(s[0]);
		for (i = 1; i < n; i++) {
			sb.append(s[i]);
		}
		out.println(sb.toString());
	}
}
