import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), l = sc.nextInt();
        String[] s = new String[n];

        for (int i = 0; i < n; i++)s[i]=sc.next();

        Arrays.sort(s);
        String ans=s[0];
        for(int i=1;i<n;i++)ans += s[i];
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), l = sc.nextInt();
        String[] s = new String[n];

        for (int i = 0; i < n; i++)s[i]=sc.next();

        Arrays.sort(s);
        String ans=s[0];
        for(int i=1;i<n;i++)ans += s[i];
        System.out.println(ans);
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), l = sc.nextInt();
        String[] s = new String[n];

        for (int i = 0; i < n; i++)s[i]=sc.next();

        Arrays.sort(s);
        String ans=s[0];
        for(int i=1;i<n;i++)ans += s[i];
        System.out.println(ans);
    } main {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), l = sc.nextInt();
        String[] s = new String[n];

        for (int i = 0; i < n; i++)s[i]=sc.next();

        Arrays.sort(s);
        String ans=s[0];
        for(int i=1;i<n;i++)ans += s[i];
        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 l = sc.nextInt(); l sc.nextInt() sc.nextInt sc String[] s = new String[n]; s new String[n] n for (int i = 0; i < n; i++)s[i]=sc.next(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i s[i]=sc.next(); s[i]=sc.next() s[i] s i sc.next() sc.next sc Arrays.sort(s) Arrays.sort Arrays s String ans=s[0]; ans s[0] s 0 for(int i=1;i<n;i++)ans += s[i]; int i=1; int i=1; i 1 i<n i n i++ i++ i ans += s[i]; ans += s[i] ans s[i] s i 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(), l = sc.nextInt();
        String[] s = new String[n];

        for (int i = 0; i < n; i++)s[i]=sc.next();

        Arrays.sort(s);
        String ans=s[0];
        for(int i=1;i<n;i++)ans += s[i];
        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), l = sc.nextInt();
        String[] s = new String[n];

        for (int i = 0; i < n; i++)s[i]=sc.next();

        Arrays.sort(s);
        String ans=s[0];
        for(int i=1;i<n;i++)ans += s[i];
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), l = sc.nextInt();
        String[] s = new String[n];

        for (int i = 0; i < n; i++)s[i]=sc.next();

        Arrays.sort(s);
        String ans=s[0];
        for(int i=1;i<n;i++)ans += s[i];
        System.out.println(ans);
    }
}
