import java.util.Scanner;
import java.util.Arrays;

/**
 * ABC042B
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc String[] strs = new String[N]; strs new String[N] N String ans = ""; ans "" for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            strs[i] = sc.nextLine();
        } {
            strs[i] = sc.nextLine();
        } strs[i] = sc.nextLine() strs[i] strs i sc.nextLine() sc.nextLine sc Arrays.sort(strs) Arrays.sort Arrays strs for (String string : strs) {
            ans += string;
        } String string strs {
            ans += string;
        } {
            ans += string;
        } ans += string ans string System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;

/**
 * ABC042B
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int L = sc.nextInt();

        /** 空読み */
        sc.nextLine();

        String[] strs = new String[N];
        String ans = "";

        for (int i = 0; i < N; i++) {
            strs[i] = sc.nextLine();
        }

        Arrays.sort(strs);
        
        for (String string : strs) {
            ans += string;
        }

        System.out.println(ans);
    }
}