import java.util.*;
public class Main {
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		List<String> lst = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		}
		
		Collections.sort(lst);

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		}
		
		System.out.println(sb);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		List<String> lst = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		}
		
		Collections.sort(lst);

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		}
		
		System.out.println(sb);
	}
} Main public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		List<String> lst = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		}
		
		Collections.sort(lst);

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		}
		
		System.out.println(sb);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		List<String> lst = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		}
		
		Collections.sort(lst);

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		}
		
		System.out.println(sb);
	} 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 List<String> lst = new ArrayList<>(); lst new ArrayList<>() for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String s = sc.next();
			lst.add(s);
		} {
			String s = sc.next();
			lst.add(s);
		} String s = sc.next(); s sc.next() sc.next sc lst.add(s) lst.add lst s Collections.sort(lst) Collections.sort Collections lst StringBuffer sb = new StringBuffer(); sb new StringBuffer() for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			sb.append(lst.get(i));
		} {
			sb.append(lst.get(i));
		} sb.append(lst.get(i)) sb.append sb lst.get(i) lst.get lst i System.out.println(sb) System.out.println System.out System System.out sb String arg[] arg public class Main {
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		List<String> lst = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		}
		
		Collections.sort(lst);

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		}
		
		System.out.println(sb);
	}
} public class Main {
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		List<String> lst = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		}
		
		Collections.sort(lst);

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		}
		
		System.out.println(sb);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		
		List<String> lst = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			String s = sc.next();
			lst.add(s);
		}
		
		Collections.sort(lst);

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append(lst.get(i));
		}
		
		System.out.println(sb);
	}
}