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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		sc.nextLine();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		}
		Collections.sort(list, Comparator.naturalOrder());
		StringBuilder sb = new StringBuilder();
		for(String str: list) {
			sb.append(str);
		}
		System.out.println(sb.toString());
		
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.HashSet; HashSet 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) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		sc.nextLine();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		}
		Collections.sort(list, Comparator.naturalOrder());
		StringBuilder sb = new StringBuilder();
		for(String str: list) {
			sb.append(str);
		}
		System.out.println(sb.toString());
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		sc.nextLine();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		}
		Collections.sort(list, Comparator.naturalOrder());
		StringBuilder sb = new StringBuilder();
		for(String str: list) {
			sb.append(str);
		}
		System.out.println(sb.toString());
		
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		sc.nextLine();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		}
		Collections.sort(list, Comparator.naturalOrder());
		StringBuilder sb = new StringBuilder();
		for(String str: list) {
			sb.append(str);
		}
		System.out.println(sb.toString());
		
	} 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 ArrayList<String> list = new ArrayList<>(); list new ArrayList<>() sc.nextLine() sc.nextLine sc for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			list.add(sc.nextLine());
		} {
			list.add(sc.nextLine());
		} list.add(sc.nextLine()) list.add list sc.nextLine() sc.nextLine sc Collections.sort(list, Comparator.naturalOrder()) Collections.sort Collections list Comparator.naturalOrder() Comparator.naturalOrder Comparator StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(String str: list) {
			sb.append(str);
		} String str list {
			sb.append(str);
		} {
			sb.append(str);
		} sb.append(str) sb.append sb str System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		sc.nextLine();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		}
		Collections.sort(list, Comparator.naturalOrder());
		StringBuilder sb = new StringBuilder();
		for(String str: list) {
			sb.append(str);
		}
		System.out.println(sb.toString());
		
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		sc.nextLine();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		}
		Collections.sort(list, Comparator.naturalOrder());
		StringBuilder sb = new StringBuilder();
		for(String str: list) {
			sb.append(str);
		}
		System.out.println(sb.toString());
		
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		ArrayList<String> list = new ArrayList<>();
		sc.nextLine();
		for(int i = 0; i < n; i++) {
			list.add(sc.nextLine());
		}
		Collections.sort(list, Comparator.naturalOrder());
		StringBuilder sb = new StringBuilder();
		for(String str: list) {
			sb.append(str);
		}
		System.out.println(sb.toString());
		
	}
}