import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = Integer.parseInt(sc.next()); a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int b = Integer.parseInt(sc.next()); b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc String[] words = new String[a]; words new String[a] a for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        } int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
            words[i] = sc.next();
        } {
            words[i] = sc.next();
        } words[i] = sc.next() words[i] words i sc.next() sc.next sc Arrays.sort(words) Arrays.sort Arrays words String result = ""; result "" for (String tmp : words) {
            result += tmp;
        } String tmp words {
            result += tmp;
        } {
            result += tmp;
        } result += tmp result tmp System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String[] words = new String[a];
        for (int i = 0; i < a; i++) {
            words[i] = sc.next();
        }
        Arrays.sort(words);
        String result = "";
        for (String tmp : words) {
            result += tmp;
        }
        System.out.println(result);
    }
}
