import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        int N = Integer.parseInt(st.nextToken());
        int n=N;
        int L = Integer.parseInt(st.nextToken());
        String[] arr = new String[N];
        int k=0;
        while(N--!=0){
            arr[k++] = br.readLine();
        }
        Arrays.sort(arr);
        String ans="";
        for(int i=0; i<n; i++){
            ans+=arr[i];
        }

        System.out.println(ans);

    }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        int N = Integer.parseInt(st.nextToken());
        int n=N;
        int L = Integer.parseInt(st.nextToken());
        String[] arr = new String[N];
        int k=0;
        while(N--!=0){
            arr[k++] = br.readLine();
        }
        Arrays.sort(arr);
        String ans="";
        for(int i=0; i<n; i++){
            ans+=arr[i];
        }

        System.out.println(ans);

    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        int N = Integer.parseInt(st.nextToken());
        int n=N;
        int L = Integer.parseInt(st.nextToken());
        String[] arr = new String[N];
        int k=0;
        while(N--!=0){
            arr[k++] = br.readLine();
        }
        Arrays.sort(arr);
        String ans="";
        for(int i=0; i<n; i++){
            ans+=arr[i];
        }

        System.out.println(ans);

    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        int N = Integer.parseInt(st.nextToken());
        int n=N;
        int L = Integer.parseInt(st.nextToken());
        String[] arr = new String[N];
        int k=0;
        while(N--!=0){
            arr[k++] = br.readLine();
        }
        Arrays.sort(arr);
        String ans="";
        for(int i=0; i<n; i++){
            ans+=arr[i];
        }

        System.out.println(ans);

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int N = Integer.parseInt(st.nextToken()); N Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int n=N; n N int L = Integer.parseInt(st.nextToken()); L Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st String[] arr = new String[N]; arr new String[N] N int k=0; k 0 while(N--!=0){
            arr[k++] = br.readLine();
        } N--!=0 N-- N 0 {
            arr[k++] = br.readLine();
        } arr[k++] = br.readLine() arr[k++] arr k++ k br.readLine() br.readLine br Arrays.sort(arr) Arrays.sort Arrays arr String ans=""; ans "" for(int i=0; i<n; i++){
            ans+=arr[i];
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            ans+=arr[i];
        } {
            ans+=arr[i];
        } ans+=arr[i] ans arr[i] arr i System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        
        int N = Integer.parseInt(st.nextToken());
        int n=N;
        int L = Integer.parseInt(st.nextToken());
        String[] arr = new String[N];
        int k=0;
        while(N--!=0){
            arr[k++] = br.readLine();
        }
        Arrays.sort(arr);
        String ans="";
        for(int i=0; i<n; i++){
            ans+=arr[i];
        }

        System.out.println(ans);

    }
}