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

public class Main {
	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	}
	

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException 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 IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	}
	

} Main public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] a = br.readLine().split(" "); a br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int N = Integer.parseInt(a[0]); N Integer.parseInt(a[0]) Integer.parseInt Integer a[0] a 0 int L = Integer.parseInt(a[1]); L Integer.parseInt(a[1]) Integer.parseInt Integer a[1] a 1 String[] words = new String[N]; words new String[N] N for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		} int i = 0 ; int i = 0 ; i 0 i < N i N i ++ i ++ i {
			words[i] = br.readLine();
		} {
			words[i] = br.readLine();
		} words[i] = br.readLine() words[i] words i br.readLine() br.readLine br Arrays.sort(words) Arrays.sort Arrays words for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		} int i = 0 ; int i = 0 ; i 0 i < N i N i++ i++ i {
			System.out.print(words[i]);
		} {
			System.out.print(words[i]);
		} System.out.print(words[i]) System.out.print System.out System System.out words[i] words i String[]args args public class Main {
	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	}
	

} public class Main {
	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	}
	

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[]args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] a = br.readLine().split(" ");
		int N = Integer.parseInt(a[0]);
		int L = Integer.parseInt(a[1]);
		String[] words = new String[N];
		for(int i = 0 ; i < N ; i ++) {
			words[i] = br.readLine();
		}
		Arrays.sort(words);
		for(int i = 0 ; i < N ; i++) {
			System.out.print(words[i]);
		}
	}
	

}