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 m = sc.nextInt();
		String[] foo =new String[n];
		
		foo[0] = sc.nextLine();
		for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		}
		Arrays.sort(foo);
		for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		}
	}
} 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 m = sc.nextInt();
		String[] foo =new String[n];
		
		foo[0] = sc.nextLine();
		for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		}
		Arrays.sort(foo);
		for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		String[] foo =new String[n];
		
		foo[0] = sc.nextLine();
		for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		}
		Arrays.sort(foo);
		for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		String[] foo =new String[n];
		
		foo[0] = sc.nextLine();
		for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		}
		Arrays.sort(foo);
		for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc String[] foo =new String[n]; foo new String[n] n foo[0] = sc.nextLine() foo[0] foo 0 sc.nextLine() sc.nextLine sc for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			foo[i] = sc.nextLine();
		} {
			foo[i] = sc.nextLine();
		} foo[i] = sc.nextLine() foo[i] foo i sc.nextLine() sc.nextLine sc Arrays.sort(foo) Arrays.sort Arrays foo for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			System.out.print(foo[i]);
		} {
			System.out.print(foo[i]);
		} System.out.print(foo[i]) System.out.print System.out System System.out foo[i] foo i String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		String[] foo =new String[n];
		
		foo[0] = sc.nextLine();
		for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		}
		Arrays.sort(foo);
		for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		String[] foo =new String[n];
		
		foo[0] = sc.nextLine();
		for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		}
		Arrays.sort(foo);
		for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		}
	}
} 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 m = sc.nextInt();
		String[] foo =new String[n];
		
		foo[0] = sc.nextLine();
		for(int i=0;i<n;i++) {
			foo[i] = sc.nextLine();
		}
		Arrays.sort(foo);
		for(int i=0;i<n;i++) {
			System.out.print(foo[i]);
		}
	}
}
