import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(), l=sc.nextInt();
		sc.nextLine();
		String res="";
		String[] str=new String[n];
		for(int i=0; i<n; ++i) str[i]=sc.nextLine(); 
		Collections.sort(Arrays.asList(str));
		for(int i=0; i<n; ++i) res+=str[i];
		System.out.println(res);
		sc.close(); 
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(), l=sc.nextInt();
		sc.nextLine();
		String res="";
		String[] str=new String[n];
		for(int i=0; i<n; ++i) str[i]=sc.nextLine(); 
		Collections.sort(Arrays.asList(str));
		for(int i=0; i<n; ++i) res+=str[i];
		System.out.println(res);
		sc.close(); 
	}

} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(), l=sc.nextInt();
		sc.nextLine();
		String res="";
		String[] str=new String[n];
		for(int i=0; i<n; ++i) str[i]=sc.nextLine(); 
		Collections.sort(Arrays.asList(str));
		for(int i=0; i<n; ++i) res+=str[i];
		System.out.println(res);
		sc.close(); 
	} main {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(), l=sc.nextInt();
		sc.nextLine();
		String res="";
		String[] str=new String[n];
		for(int i=0; i<n; ++i) str[i]=sc.nextLine(); 
		Collections.sort(Arrays.asList(str));
		for(int i=0; i<n; ++i) res+=str[i];
		System.out.println(res);
		sc.close(); 
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt() n sc.nextInt() sc.nextInt sc l=sc.nextInt(); l sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc String res=""; res "" String[] str=new String[n]; str new String[n] n for(int i=0; i<n; ++i) str[i]=sc.nextLine(); int i=0; int i=0; i 0 i<n i n ++i ++i i str[i]=sc.nextLine(); str[i]=sc.nextLine() str[i] str i sc.nextLine() sc.nextLine sc Collections.sort(Arrays.asList(str)) Collections.sort Collections Arrays.asList(str) Arrays.asList Arrays str for(int i=0; i<n; ++i) res+=str[i]; int i=0; int i=0; i 0 i<n i n ++i ++i i res+=str[i]; res+=str[i] res str[i] str i System.out.println(res) System.out.println System.out System System.out res sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(), l=sc.nextInt();
		sc.nextLine();
		String res="";
		String[] str=new String[n];
		for(int i=0; i<n; ++i) str[i]=sc.nextLine(); 
		Collections.sort(Arrays.asList(str));
		for(int i=0; i<n; ++i) res+=str[i];
		System.out.println(res);
		sc.close(); 
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(), l=sc.nextInt();
		sc.nextLine();
		String res="";
		String[] str=new String[n];
		for(int i=0; i<n; ++i) str[i]=sc.nextLine(); 
		Collections.sort(Arrays.asList(str));
		for(int i=0; i<n; ++i) res+=str[i];
		System.out.println(res);
		sc.close(); 
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(), l=sc.nextInt();
		sc.nextLine();
		String res="";
		String[] str=new String[n];
		for(int i=0; i<n; ++i) str[i]=sc.nextLine(); 
		Collections.sort(Arrays.asList(str));
		for(int i=0; i<n; ++i) res+=str[i];
		System.out.println(res);
		sc.close(); 
	}

}