import java.util.Arrays;
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();
		String ans = null;
		String [] array = new String [n];
		for (int i =0; i < n; i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for (int i = 0; i < n; i ++) {
			ans += array[i];
		}
		System.out.println(ans.substring(ans.length()- (n * l), ans.length()));
	}
} import java.util.Arrays; Arrays 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();
		String ans = null;
		String [] array = new String [n];
		for (int i =0; i < n; i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for (int i = 0; i < n; i ++) {
			ans += array[i];
		}
		System.out.println(ans.substring(ans.length()- (n * l), ans.length()));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		String ans = null;
		String [] array = new String [n];
		for (int i =0; i < n; i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for (int i = 0; i < n; i ++) {
			ans += array[i];
		}
		System.out.println(ans.substring(ans.length()- (n * l), ans.length()));
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		String ans = null;
		String [] array = new String [n];
		for (int i =0; i < n; i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for (int i = 0; i < n; i ++) {
			ans += array[i];
		}
		System.out.println(ans.substring(ans.length()- (n * l), ans.length()));
	} 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 String ans = null; ans null String [] array = new String [n]; array new String [n] n for (int i =0; i < n; i++) {
			array[i] = sc.next();
		} int i =0; int i =0; i 0 i < n i n i++ i++ i {
			array[i] = sc.next();
		} {
			array[i] = sc.next();
		} array[i] = sc.next() array[i] array i sc.next() sc.next sc Arrays.sort(array) Arrays.sort Arrays array for (int i = 0; i < n; i ++) {
			ans += array[i];
		} int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
			ans += array[i];
		} {
			ans += array[i];
		} ans += array[i] ans array[i] array i System.out.println(ans.substring(ans.length()- (n * l), ans.length())) System.out.println System.out System System.out ans.substring(ans.length()- (n * l), ans.length()) ans.substring ans ans.length()- (n * l) ans.length() ans.length ans (n * l) n l ans.length() ans.length ans 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();
		String ans = null;
		String [] array = new String [n];
		for (int i =0; i < n; i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for (int i = 0; i < n; i ++) {
			ans += array[i];
		}
		System.out.println(ans.substring(ans.length()- (n * l), ans.length()));
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		String ans = null;
		String [] array = new String [n];
		for (int i =0; i < n; i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for (int i = 0; i < n; i ++) {
			ans += array[i];
		}
		System.out.println(ans.substring(ans.length()- (n * l), ans.length()));
	}
} Main
import java.util.Arrays;
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();
		String ans = null;
		String [] array = new String [n];
		for (int i =0; i < n; i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for (int i = 0; i < n; i ++) {
			ans += array[i];
		}
		System.out.println(ans.substring(ans.length()- (n * l), ans.length()));
	}
}
