
import java.util.*;

class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());
		String s[] = new String[N];
		String ans = "";
      
		for(int i = 0;i < N; i++) {
			s[i] = sc.next();
		}
		Arrays.sort(s);
		
		for(String ss : s) {
			ans += ss;
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());
		String s[] = new String[N];
		String ans = "";
      
		for(int i = 0;i < N; i++) {
			s[i] = sc.next();
		}
		Arrays.sort(s);
		
		for(String ss : s) {
			ans += ss;
		}
		System.out.println(ans);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());
		String s[] = new String[N];
		String ans = "";
      
		for(int i = 0;i < N; i++) {
			s[i] = sc.next();
		}
		Arrays.sort(s);
		
		for(String ss : s) {
			ans += ss;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());
		String s[] = new String[N];
		String ans = "";
      
		for(int i = 0;i < N; i++) {
			s[i] = sc.next();
		}
		Arrays.sort(s);
		
		for(String ss : s) {
			ans += ss;
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int L = Integer.parseInt(sc.next()); L Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String s[] = new String[N]; s new String[N] N String ans = ""; ans "" for(int i = 0;i < N; i++) {
			s[i] = sc.next();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			s[i] = sc.next();
		} {
			s[i] = sc.next();
		} s[i] = sc.next() s[i] s i sc.next() sc.next sc Arrays.sort(s) Arrays.sort Arrays s for(String ss : s) {
			ans += ss;
		} String ss s {
			ans += ss;
		} {
			ans += ss;
		} ans += ss ans ss System.out.println(ans) System.out.println System.out System System.out ans String args[] args

import java.util.*;

class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int L = Integer.parseInt(sc.next());
		String s[] = new String[N];
		String ans = "";
      
		for(int i = 0;i < N; i++) {
			s[i] = sc.next();
		}
		Arrays.sort(s);
		
		for(String ss : s) {
			ans += ss;
		}
		System.out.println(ans);
	}
}
