import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt(){
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		}
	}
	class B{
		void doIt(){
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		}
	}
	class C{
		void doIt(){
			
		}
	}
	class D{
		void doIt(){
			
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt(){
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		}
	}
	class B{
		void doIt(){
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		}
	}
	class C{
		void doIt(){
			
		}
	}
	class D{
		void doIt(){
			
		}
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
		new Main();
	} main {
		new Main();
	} new Main() String[] args args public Main(){
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	} Main {
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	} new B().doIt() new B().doIt new B() class A{
		void doIt(){
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		}
	} A void doIt(){
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		} doIt {
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		} int A[] = new int[3]; A new int[3] 3 for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next()); int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i A[i] = Integer.parseInt(sc.next()); A[i] = Integer.parseInt(sc.next()) A[i] A i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int five = 0; five 0 int seven = 0; seven 0 for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			} {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			} if(A[i] == 5)five++;
				else if(A[i] == 7)seven++; A[i] == 5 A[i] A i 5 five++ five if(A[i] == 7)seven++; A[i] == 7 A[i] A i 7 seven++ seven if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO"); five == 2 && seven == 1 five == 2 five 2 seven == 1 seven 1 System.out.print("YES") System.out.print System.out System System.out "YES" System.out.println("NO") System.out.println System.out System System.out "NO" class B{
		void doIt(){
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		}
	} B void doIt(){
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		} doIt {
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		} int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc String str[] = new String[N]; str new String[N] N for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
				str[i] = sc.next();
			} {
				str[i] = sc.next();
			} str[i] = sc.next() str[i] str i sc.next() sc.next sc Arrays.sort(str) Arrays.sort Arrays str for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
				System.out.print(str[i]);
			} {
				System.out.print(str[i]);
			} System.out.print(str[i]) System.out.print System.out System System.out str[i] str i System.out.println() System.out.println System.out System System.out class C{
		void doIt(){
			
		}
	} C void doIt(){
			
		} doIt {
			
		} class D{
		void doIt(){
			
		}
	} D void doIt(){
			
		} doIt {
			
		} public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt(){
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		}
	}
	class B{
		void doIt(){
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		}
	}
	class C{
		void doIt(){
			
		}
	}
	class D{
		void doIt(){
			
		}
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt(){
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		}
	}
	class B{
		void doIt(){
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		}
	}
	class C{
		void doIt(){
			
		}
	}
	class D{
		void doIt(){
			
		}
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new A().doIt();
		new B().doIt();
//		new C().doIt();
//		new D().doIt();
	}
	class A{
		void doIt(){
			int A[] = new int[3];
			for(int i = 0;i < 3;i++)A[i] = Integer.parseInt(sc.next());
			int five = 0;
			int seven = 0;
			for(int i = 0;i < 3;i++) {
				if(A[i] == 5)five++;
				else if(A[i] == 7)seven++;
			}
			if(five == 2 && seven == 1)System.out.print("YES");
			else System.out.println("NO");
		}
	}
	class B{
		void doIt(){
			int N = sc.nextInt();
			int L = sc.nextInt();
			String str[] = new String[N];
			for(int i = 0;i < N;i++) {
				str[i] = sc.next();
			}
			Arrays.sort(str);
			for(int i = 0;i < N;i++) {
				System.out.print(str[i]);
			}
			System.out.println();
		}
	}
	class C{
		void doIt(){
			
		}
	}
	class D{
		void doIt(){
			
		}
	}
}
