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

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int L = cin.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        }

        Arrays.sort(S);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        }

        System.out.println(sb.toString());
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int L = cin.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        }

        Arrays.sort(S);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        }

        System.out.println(sb.toString());
    }
} Main public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int L = cin.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        }

        Arrays.sort(S);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        }

        System.out.println(sb.toString());
    } main {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int L = cin.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        }

        Arrays.sort(S);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        }

        System.out.println(sb.toString());
    } Scanner cin = new Scanner(System.in); cin new Scanner(System.in) int N = cin.nextInt(); N cin.nextInt() cin.nextInt cin int L = cin.nextInt(); L cin.nextInt() cin.nextInt cin String[] S = new String[N]; S new String[N] N for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            S[i] = cin.next().substring(0, L);
        } {
            S[i] = cin.next().substring(0, L);
        } S[i] = cin.next().substring(0, L) S[i] S i cin.next().substring(0, L) cin.next().substring cin.next() cin.next cin 0 L Arrays.sort(S) Arrays.sort Arrays S StringBuffer sb = new StringBuffer(); sb new StringBuffer() for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            sb.append(S[i]);
        } {
            sb.append(S[i]);
        } sb.append(S[i]) sb.append sb S[i] S i System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int L = cin.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        }

        Arrays.sort(S);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        }

        System.out.println(sb.toString());
    }
} public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int L = cin.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        }

        Arrays.sort(S);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        }

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

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        int L = cin.nextInt();
        String[] S = new String[N];
        for (int i = 0; i < N; i++) {
            S[i] = cin.next().substring(0, L);
        }

        Arrays.sort(S);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < N; i++) {
            sb.append(S[i]);
        }

        System.out.println(sb.toString());
    }
}
