import java.util.*;
public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int len = sc.nextInt();
        String[] strs = new String[n];
        for(int i = 0; i < n; i++)
            strs[i] = sc.next();

        Arrays.sort(strs);
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++)
            sb.append(strs[i]);
        System.out.println(sb.toString());
    }
} import java.util.*; util.* java public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int len = sc.nextInt();
        String[] strs = new String[n];
        for(int i = 0; i < n; i++)
            strs[i] = sc.next();

        Arrays.sort(strs);
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++)
            sb.append(strs[i]);
        System.out.println(sb.toString());
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int len = sc.nextInt();
        String[] strs = new String[n];
        for(int i = 0; i < n; i++)
            strs[i] = sc.next();

        Arrays.sort(strs);
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++)
            sb.append(strs[i]);
        System.out.println(sb.toString());
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int len = sc.nextInt();
        String[] strs = new String[n];
        for(int i = 0; i < n; i++)
            strs[i] = sc.next();

        Arrays.sort(strs);
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++)
            sb.append(strs[i]);
        System.out.println(sb.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int len = sc.nextInt(); len sc.nextInt() sc.nextInt sc String[] strs = new String[n]; strs new String[n] n for(int i = 0; i < n; i++)
            strs[i] = sc.next(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i strs[i] = sc.next(); strs[i] = sc.next() strs[i] strs i sc.next() sc.next sc Arrays.sort(strs) Arrays.sort Arrays strs StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < n; i++)
            sb.append(strs[i]); int i = 0; int i = 0; i 0 i < n i n i++ i++ i sb.append(strs[i]); sb.append(strs[i]) sb.append sb strs[i] strs 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 sc = new Scanner(System.in);
        int n = sc.nextInt();
        int len = sc.nextInt();
        String[] strs = new String[n];
        for(int i = 0; i < n; i++)
            strs[i] = sc.next();

        Arrays.sort(strs);
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++)
            sb.append(strs[i]);
        System.out.println(sb.toString());
    }
} public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int len = sc.nextInt();
        String[] strs = new String[n];
        for(int i = 0; i < n; i++)
            strs[i] = sc.next();

        Arrays.sort(strs);
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++)
            sb.append(strs[i]);
        System.out.println(sb.toString());
    }
} Main
import java.util.*;
public class Main { 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int len = sc.nextInt();
        String[] strs = new String[n];
        for(int i = 0; i < n; i++)
            strs[i] = sc.next();

        Arrays.sort(strs);
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++)
            sb.append(strs[i]);
        System.out.println(sb.toString());
    }
}