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


public class Main {

	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int length = sc.nextInt();
		List<String> abc = new ArrayList<String>();
		for(i=0;i<number;i++) {
			abc.add(sc.next());
		}
		Collections.sort(abc);
		String result = String.join("", abc);
		System.out.println(result);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections 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) {
		int i;
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int length = sc.nextInt();
		List<String> abc = new ArrayList<String>();
		for(i=0;i<number;i++) {
			abc.add(sc.next());
		}
		Collections.sort(abc);
		String result = String.join("", abc);
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int length = sc.nextInt();
		List<String> abc = new ArrayList<String>();
		for(i=0;i<number;i++) {
			abc.add(sc.next());
		}
		Collections.sort(abc);
		String result = String.join("", abc);
		System.out.println(result);
	} main {
		int i;
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int length = sc.nextInt();
		List<String> abc = new ArrayList<String>();
		for(i=0;i<number;i++) {
			abc.add(sc.next());
		}
		Collections.sort(abc);
		String result = String.join("", abc);
		System.out.println(result);
	} int i; i Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int number = sc.nextInt(); number sc.nextInt() sc.nextInt sc int length = sc.nextInt(); length sc.nextInt() sc.nextInt sc List<String> abc = new ArrayList<String>(); abc new ArrayList<String>() for(i=0;i<number;i++) {
			abc.add(sc.next());
		} i=0; i=0 i 0 i<number i number i++ i++ i {
			abc.add(sc.next());
		} {
			abc.add(sc.next());
		} abc.add(sc.next()) abc.add abc sc.next() sc.next sc Collections.sort(abc) Collections.sort Collections abc String result = String.join("", abc); result String.join("", abc) String.join String "" abc System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int length = sc.nextInt();
		List<String> abc = new ArrayList<String>();
		for(i=0;i<number;i++) {
			abc.add(sc.next());
		}
		Collections.sort(abc);
		String result = String.join("", abc);
		System.out.println(result);
	}
} public class Main {

	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int length = sc.nextInt();
		List<String> abc = new ArrayList<String>();
		for(i=0;i<number;i++) {
			abc.add(sc.next());
		}
		Collections.sort(abc);
		String result = String.join("", abc);
		System.out.println(result);
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int length = sc.nextInt();
		List<String> abc = new ArrayList<String>();
		for(i=0;i<number;i++) {
			abc.add(sc.next());
		}
		Collections.sort(abc);
		String result = String.join("", abc);
		System.out.println(result);
	}
}