import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		String[] S = new String[a];
		String output = "";
		for (int i = 0;  i < a; i++ ) S[i] = scan.next();
		Arrays.sort(S);
		for (int i = 0;  i < a; i++ ) System.out.print(S[i]);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		String[] S = new String[a];
		String output = "";
		for (int i = 0;  i < a; i++ ) S[i] = scan.next();
		Arrays.sort(S);
		for (int i = 0;  i < a; i++ ) System.out.print(S[i]);
	}
} Main public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		String[] S = new String[a];
		String output = "";
		for (int i = 0;  i < a; i++ ) S[i] = scan.next();
		Arrays.sort(S);
		for (int i = 0;  i < a; i++ ) System.out.print(S[i]);
	} main {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		String[] S = new String[a];
		String output = "";
		for (int i = 0;  i < a; i++ ) S[i] = scan.next();
		Arrays.sort(S);
		for (int i = 0;  i < a; i++ ) System.out.print(S[i]);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt() a scan.nextInt() scan.nextInt scan b = scan.nextInt(); b scan.nextInt() scan.nextInt scan String[] S = new String[a]; S new String[a] a String output = ""; output "" for (int i = 0;  i < a; i++ ) S[i] = scan.next(); int i = 0; int i = 0; i 0 i < a i a i++ i++ i S[i] = scan.next(); S[i] = scan.next() S[i] S i scan.next() scan.next scan Arrays.sort(S) Arrays.sort Arrays S for (int i = 0;  i < a; i++ ) System.out.print(S[i]); int i = 0; int i = 0; i 0 i < a i a i++ i++ i System.out.print(S[i]); System.out.print(S[i]) System.out.print System.out System System.out S[i] S i String[] args args public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		String[] S = new String[a];
		String output = "";
		for (int i = 0;  i < a; i++ ) S[i] = scan.next();
		Arrays.sort(S);
		for (int i = 0;  i < a; i++ ) System.out.print(S[i]);
	}
} public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		String[] S = new String[a];
		String output = "";
		for (int i = 0;  i < a; i++ ) S[i] = scan.next();
		Arrays.sort(S);
		for (int i = 0;  i < a; i++ ) System.out.print(S[i]);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		String[] S = new String[a];
		String output = "";
		for (int i = 0;  i < a; i++ ) S[i] = scan.next();
		Arrays.sort(S);
		for (int i = 0;  i < a; i++ ) System.out.print(S[i]);
	}
}