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

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[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        }
        sc.close();

        Arrays.sort(s);

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(s[i]);
        }

        System.out.println(sb);
    }
} 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[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        }
        sc.close();

        Arrays.sort(s);

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(s[i]);
        }

        System.out.println(sb);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        sc.nextLine();
        
        String[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        }
        sc.close();

        Arrays.sort(s);

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(s[i]);
        }

        System.out.println(sb);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = sc.nextInt();
        sc.nextLine();
        
        String[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        }
        sc.close();

        Arrays.sort(s);

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(s[i]);
        }

        System.out.println(sb);
    } 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[] s = new String[n]; s new String[n] n for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            s[i] = sc.nextLine();
        } {
            s[i] = sc.nextLine();
        } s[i] = sc.nextLine() s[i] s i sc.nextLine() sc.nextLine sc sc.close() sc.close sc Arrays.sort(s) Arrays.sort Arrays s StringBuilder sb = new StringBuilder(); sb new StringBuilder() 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) System.out.println System.out System System.out sb 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[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        }
        sc.close();

        Arrays.sort(s);

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(s[i]);
        }

        System.out.println(sb);
    }
} 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[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        }
        sc.close();

        Arrays.sort(s);

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(s[i]);
        }

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

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[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = sc.nextLine();
        }
        sc.close();

        Arrays.sort(s);

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(s[i]);
        }

        System.out.println(sb);
    }
}
