import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int volume = scanner.nextInt();
        int length = scanner.nextInt();
        // 文字の取得
        List<String> list = new ArrayList<>();
        for (int n = 0; n < volume; n ++) {
            String word = scanner.next();
            list.add(word);
        }
        List<String> sortedList = list.stream().sorted(Comparator.naturalOrder())
                .collect(Collectors.toList());
        String result = "";
        for (String word : sortedList) {
            result += word;
        }
        System.out.println(result);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Comparator; Comparator java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.stream.Collectors; Collectors java.util.stream class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int volume = scanner.nextInt();
        int length = scanner.nextInt();
        // 文字の取得
        List<String> list = new ArrayList<>();
        for (int n = 0; n < volume; n ++) {
            String word = scanner.next();
            list.add(word);
        }
        List<String> sortedList = list.stream().sorted(Comparator.naturalOrder())
                .collect(Collectors.toList());
        String result = "";
        for (String word : sortedList) {
            result += word;
        }
        System.out.println(result);
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int volume = scanner.nextInt();
        int length = scanner.nextInt();
        // 文字の取得
        List<String> list = new ArrayList<>();
        for (int n = 0; n < volume; n ++) {
            String word = scanner.next();
            list.add(word);
        }
        List<String> sortedList = list.stream().sorted(Comparator.naturalOrder())
                .collect(Collectors.toList());
        String result = "";
        for (String word : sortedList) {
            result += word;
        }
        System.out.println(result);
    } main {
        Scanner scanner = new Scanner(System.in);
        int volume = scanner.nextInt();
        int length = scanner.nextInt();
        // 文字の取得
        List<String> list = new ArrayList<>();
        for (int n = 0; n < volume; n ++) {
            String word = scanner.next();
            list.add(word);
        }
        List<String> sortedList = list.stream().sorted(Comparator.naturalOrder())
                .collect(Collectors.toList());
        String result = "";
        for (String word : sortedList) {
            result += word;
        }
        System.out.println(result);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int volume = scanner.nextInt(); volume scanner.nextInt() scanner.nextInt scanner int length = scanner.nextInt(); length scanner.nextInt() scanner.nextInt scanner List<String> list = new ArrayList<>(); list new ArrayList<>() for (int n = 0; n < volume; n ++) {
            String word = scanner.next();
            list.add(word);
        } int n = 0; int n = 0; n 0 n < volume n volume n ++ n ++ n {
            String word = scanner.next();
            list.add(word);
        } {
            String word = scanner.next();
            list.add(word);
        } String word = scanner.next(); word scanner.next() scanner.next scanner list.add(word) list.add list word List<String> sortedList = list.stream().sorted(Comparator.naturalOrder())
                .collect(Collectors.toList()); sortedList list.stream().sorted(Comparator.naturalOrder())
                .collect(Collectors.toList()) list.stream().sorted(Comparator.naturalOrder())
                .collect list.stream().sorted(Comparator.naturalOrder()) list.stream().sorted list.stream() list.stream list Comparator.naturalOrder() Comparator.naturalOrder Comparator Collectors.toList() Collectors.toList Collectors String result = ""; result "" for (String word : sortedList) {
            result += word;
        } String word sortedList {
            result += word;
        } {
            result += word;
        } result += word result word System.out.println(result) System.out.println System.out System System.out result String[] args args
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int volume = scanner.nextInt();
        int length = scanner.nextInt();
        // 文字の取得
        List<String> list = new ArrayList<>();
        for (int n = 0; n < volume; n ++) {
            String word = scanner.next();
            list.add(word);
        }
        List<String> sortedList = list.stream().sorted(Comparator.naturalOrder())
                .collect(Collectors.toList());
        String result = "";
        for (String word : sortedList) {
            result += word;
        }
        System.out.println(result);
    }
}