import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] s = br.readLine().split("\\s+");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		String[] str = new String[n];
		for(int i=0;i<n;i++)
			str[i] = br.readLine();
		
		Arrays.sort(str);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++)
			sb.append(str[i]);
		System.out.println(sb);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {

	public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] s = br.readLine().split("\\s+");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		String[] str = new String[n];
		for(int i=0;i<n;i++)
			str[i] = br.readLine();
		
		Arrays.sort(str);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++)
			sb.append(str[i]);
		System.out.println(sb);
	}
} Main public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] s = br.readLine().split("\\s+");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		String[] str = new String[n];
		for(int i=0;i<n;i++)
			str[i] = br.readLine();
		
		Arrays.sort(str);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++)
			sb.append(str[i]);
		System.out.println(sb);
	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] s = br.readLine().split("\\s+");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		String[] str = new String[n];
		for(int i=0;i<n;i++)
			str[i] = br.readLine();
		
		Arrays.sort(str);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++)
			sb.append(str[i]);
		System.out.println(sb);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] s = br.readLine().split("\\s+"); s br.readLine().split("\\s+") br.readLine().split br.readLine() br.readLine br "\\s+" int n = Integer.parseInt(s[0]); n Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int m = Integer.parseInt(s[1]); m Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 String[] str = new String[n]; str new String[n] n for(int i=0;i<n;i++)
			str[i] = br.readLine(); int i=0; int i=0; i 0 i<n i n i++ i++ i str[i] = br.readLine(); str[i] = br.readLine() str[i] str i br.readLine() br.readLine br Arrays.sort(str) Arrays.sort Arrays str StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i=0;i<n;i++)
			sb.append(str[i]); int i=0; int i=0; i 0 i<n i n i++ i++ i sb.append(str[i]); sb.append(str[i]) sb.append sb str[i] str i System.out.println(sb) System.out.println System.out System System.out sb String[] args args public class Main {

	public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] s = br.readLine().split("\\s+");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		String[] str = new String[n];
		for(int i=0;i<n;i++)
			str[i] = br.readLine();
		
		Arrays.sort(str);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++)
			sb.append(str[i]);
		System.out.println(sb);
	}
} public class Main {

	public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] s = br.readLine().split("\\s+");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		String[] str = new String[n];
		for(int i=0;i<n;i++)
			str[i] = br.readLine();
		
		Arrays.sort(str);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++)
			sb.append(str[i]);
		System.out.println(sb);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String[] s = br.readLine().split("\\s+");
		int n = Integer.parseInt(s[0]);
		int m = Integer.parseInt(s[1]);
		String[] str = new String[n];
		for(int i=0;i<n;i++)
			str[i] = br.readLine();
		
		Arrays.sort(str);
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++)
			sb.append(str[i]);
		System.out.println(sb);
	}
}
