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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	}

} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int L = scan.nextInt(); L scan.nextInt() scan.nextInt scan String[] S = new String[N]; S new String[N] N String tmp = ""; tmp "" String blank = scan.nextLine(); blank scan.nextLine() scan.nextLine scan for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			S[i] = scan.nextLine();
		} {
			S[i] = scan.nextLine();
		} S[i] = scan.nextLine() S[i] S i scan.nextLine() scan.nextLine scan Arrays.sort(S) Arrays.sort Arrays S for(int i = 0; i < N; i++) {
			tmp += S[i];
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			tmp += S[i];
		} {
			tmp += S[i];
		} tmp += S[i] tmp S[i] S i System.out.print(tmp) System.out.print System.out System System.out tmp scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	}

}
