import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		List<String> list=new ArrayList<String>();
		for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		}
		Collections.sort(list);
		for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections 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 scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		List<String> list=new ArrayList<String>();
		for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		}
		Collections.sort(list);
		for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		List<String> list=new ArrayList<String>();
		for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		}
		Collections.sort(list);
		for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	} main {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		List<String> list=new ArrayList<String>();
		for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		}
		Collections.sort(list);
		for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a=scan.nextInt(); a scan.nextInt() scan.nextInt scan int b=scan.nextInt(); b scan.nextInt() scan.nextInt scan List<String> list=new ArrayList<String>(); list new ArrayList<String>() for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		} int i=0; int i=0; i 0 i!=a i a i++ i++ i {
			String str=scan.next();
			list.add(str);
		} {
			String str=scan.next();
			list.add(str);
		} String str=scan.next(); str scan.next() scan.next scan list.add(str) list.add list str Collections.sort(list) Collections.sort Collections list for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		} int i=0; int i=0; i 0 i!=list.size() i list.size() list.size list i++ i++ i {
			System.out.print(list.get(i));
		} {
			System.out.print(list.get(i));
		} System.out.print(list.get(i)) System.out.print System.out System System.out list.get(i) list.get list i System.out.println() System.out.println System.out System System.out String[] args args public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		List<String> list=new ArrayList<String>();
		for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		}
		Collections.sort(list);
		for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	}
} public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		List<String> list=new ArrayList<String>();
		for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		}
		Collections.sort(list);
		for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		List<String> list=new ArrayList<String>();
		for(int i=0;i!=a;i++) {
			String str=scan.next();
			list.add(str);
		}
		Collections.sort(list);
		for(int i=0;i!=list.size();i++) {
			System.out.print(list.get(i));
		}
		System.out.println();
	}
}