import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		List<String> list = new ArrayList<>(); 
		for(int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		StringBuilder val = new StringBuilder();
		for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		}
		System.out.println(val);
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		List<String> list = new ArrayList<>(); 
		for(int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		StringBuilder val = new StringBuilder();
		for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		}
		System.out.println(val);
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		List<String> list = new ArrayList<>(); 
		for(int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		StringBuilder val = new StringBuilder();
		for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		}
		System.out.println(val);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		List<String> list = new ArrayList<>(); 
		for(int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		StringBuilder val = new StringBuilder();
		for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		}
		System.out.println(val);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc List<String> list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i < a; i++) {
			list.add(sc.next());
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			list.add(sc.next());
		} {
			list.add(sc.next());
		} list.add(sc.next()) list.add list sc.next() sc.next sc Collections.sort(list) Collections.sort Collections list StringBuilder val = new StringBuilder(); val new StringBuilder() for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		} int j = 0; int j = 0; j 0 j < list.size() j list.size() list.size list j++ j++ j {
			val.append(list.get(j));
		} {
			val.append(list.get(j));
		} val.append(list.get(j)) val.append val list.get(j) list.get list j System.out.println(val) System.out.println System.out System System.out val String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		List<String> list = new ArrayList<>(); 
		for(int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		StringBuilder val = new StringBuilder();
		for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		}
		System.out.println(val);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		List<String> list = new ArrayList<>(); 
		for(int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		StringBuilder val = new StringBuilder();
		for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		}
		System.out.println(val);
	}
} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		List<String> list = new ArrayList<>(); 
		for(int i = 0; i < a; i++) {
			list.add(sc.next());
		}
		Collections.sort(list);
		StringBuilder val = new StringBuilder();
		for(int j = 0; j < list.size(); j++) {
			val.append(list.get(j));
		}
		System.out.println(val);
	}
}
