import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        List<String> S = new ArrayList<String>();
        for (int i = 0 ; i < N; i++) {
            S.add(sc.next());
        }
        Collections.sort(S);

        StringBuilder ans = new StringBuilder();
        for (String s :S) {
            ans.append(s);
        }
        System.out.println(ans.toString());

        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        List<String> S = new ArrayList<String>();
        for (int i = 0 ; i < N; i++) {
            S.add(sc.next());
        }
        Collections.sort(S);

        StringBuilder ans = new StringBuilder();
        for (String s :S) {
            ans.append(s);
        }
        System.out.println(ans.toString());

        return;
    }

} Solver public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        List<String> S = new ArrayList<String>();
        for (int i = 0 ; i < N; i++) {
            S.add(sc.next());
        }
        Collections.sort(S);

        StringBuilder ans = new StringBuilder();
        for (String s :S) {
            ans.append(s);
        }
        System.out.println(ans.toString());

        return;
    } run {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        List<String> S = new ArrayList<String>();
        for (int i = 0 ; i < N; i++) {
            S.add(sc.next());
        }
        Collections.sort(S);

        StringBuilder ans = new StringBuilder();
        for (String s :S) {
            ans.append(s);
        }
        System.out.println(ans.toString());

        return;
    } 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 List<String> S = new ArrayList<String>(); S new ArrayList<String>() for (int i = 0 ; i < N; i++) {
            S.add(sc.next());
        } int i = 0 ; int i = 0 ; i 0 i < N i N i++ i++ i {
            S.add(sc.next());
        } {
            S.add(sc.next());
        } S.add(sc.next()) S.add S sc.next() sc.next sc Collections.sort(S) Collections.sort Collections S StringBuilder ans = new StringBuilder(); ans new StringBuilder() for (String s :S) {
            ans.append(s);
        } String s S {
            ans.append(s);
        } {
            ans.append(s);
        } ans.append(s) ans.append ans s System.out.println(ans.toString()) System.out.println System.out System System.out ans.toString() ans.toString ans return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        List<String> S = new ArrayList<String>();
        for (int i = 0 ; i < N; i++) {
            S.add(sc.next());
        }
        Collections.sort(S);

        StringBuilder ans = new StringBuilder();
        for (String s :S) {
            ans.append(s);
        }
        System.out.println(ans.toString());

        return;
    }

}