import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		}
		//辞書順にソート
		S.sort(Comparator.naturalOrder());
		//出力
		for (String s : S) {
			System.out.print(s);
		}

	}

} import java.util.ArrayList; ArrayList java.util import java.util.Comparator; Comparator 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) {
		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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		}
		//辞書順にソート
		S.sort(Comparator.naturalOrder());
		//出力
		for (String s : S) {
			System.out.print(s);
		}

	}

} Main public static void main(String[] args) {
		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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		}
		//辞書順にソート
		S.sort(Comparator.naturalOrder());
		//出力
		for (String s : S) {
			System.out.print(s);
		}

	} main {
		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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		}
		//辞書順にソート
		S.sort(Comparator.naturalOrder());
		//出力
		for (String s : S) {
			System.out.print(s);
		}

	} 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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		} {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		} String s = sc.next(); s sc.next() sc.next sc if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			} s.length() == L s.length() s.length s L {
				S.add(s);
			} S.add(s) S.add S s {
				i--;
			} i-- i S.sort(Comparator.naturalOrder()) S.sort S Comparator.naturalOrder() Comparator.naturalOrder Comparator for (String s : S) {
			System.out.print(s);
		} String s S {
			System.out.print(s);
		} {
			System.out.print(s);
		} System.out.print(s) System.out.print System.out System System.out s String[] args args public class Main {
	public static void main(String[] args) {
		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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		}
		//辞書順にソート
		S.sort(Comparator.naturalOrder());
		//出力
		for (String s : S) {
			System.out.print(s);
		}

	}

} public class Main {
	public static void main(String[] args) {
		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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		}
		//辞書順にソート
		S.sort(Comparator.naturalOrder());
		//出力
		for (String s : S) {
			System.out.print(s);
		}

	}

} Main
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		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++) {
			String s = sc.next();
			if(s.length() == L) {
				S.add(s);
			}else {
				i--;
			}
		}
		//辞書順にソート
		S.sort(Comparator.naturalOrder());
		//出力
		for (String s : S) {
			System.out.print(s);
		}

	}

}
