import java.util.*;

// Iroha's Strings
public class Main {
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // String params = scanner.nextLine();
        int numStrings = scanner.nextInt();
        int stringLen = scanner.nextInt(); 
        scanner.nextLine();
        // scanner.next() reads up until \n it won't consume it. You need next Line to pusition the 
        // System.out.println(scanner.nextLine()); // handle of first line \n that is

        List<String> strings = new ArrayList<>();
        for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        }
        // I have the strings now simply sort them and concatenate
        Collections.sort(strings);
        StringBuilder sb = new StringBuilder();
        for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        }                       
        scanner.close();            
        System.out.println(sb.toString());
    }
    
} import java.util.*; util.* java public class Main {
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // String params = scanner.nextLine();
        int numStrings = scanner.nextInt();
        int stringLen = scanner.nextInt(); 
        scanner.nextLine();
        // scanner.next() reads up until \n it won't consume it. You need next Line to pusition the 
        // System.out.println(scanner.nextLine()); // handle of first line \n that is

        List<String> strings = new ArrayList<>();
        for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        }
        // I have the strings now simply sort them and concatenate
        Collections.sort(strings);
        StringBuilder sb = new StringBuilder();
        for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        }                       
        scanner.close();            
        System.out.println(sb.toString());
    }
    
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // String params = scanner.nextLine();
        int numStrings = scanner.nextInt();
        int stringLen = scanner.nextInt(); 
        scanner.nextLine();
        // scanner.next() reads up until \n it won't consume it. You need next Line to pusition the 
        // System.out.println(scanner.nextLine()); // handle of first line \n that is

        List<String> strings = new ArrayList<>();
        for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        }
        // I have the strings now simply sort them and concatenate
        Collections.sort(strings);
        StringBuilder sb = new StringBuilder();
        for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        }                       
        scanner.close();            
        System.out.println(sb.toString());
    } main {
        Scanner scanner = new Scanner(System.in);
        // String params = scanner.nextLine();
        int numStrings = scanner.nextInt();
        int stringLen = scanner.nextInt(); 
        scanner.nextLine();
        // scanner.next() reads up until \n it won't consume it. You need next Line to pusition the 
        // System.out.println(scanner.nextLine()); // handle of first line \n that is

        List<String> strings = new ArrayList<>();
        for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        }
        // I have the strings now simply sort them and concatenate
        Collections.sort(strings);
        StringBuilder sb = new StringBuilder();
        for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        }                       
        scanner.close();            
        System.out.println(sb.toString());
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int numStrings = scanner.nextInt(); numStrings scanner.nextInt() scanner.nextInt scanner int stringLen = scanner.nextInt(); stringLen scanner.nextInt() scanner.nextInt scanner scanner.nextLine() scanner.nextLine scanner List<String> strings = new ArrayList<>(); strings new ArrayList<>() for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        } int i=0; int i=0; i 0 i<numStrings i numStrings i++ i++ i {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        } {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        } String curr = scanner.nextLine(); curr scanner.nextLine() scanner.nextLine scanner strings.add(curr) strings.add strings curr Collections.sort(strings) Collections.sort Collections strings StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        } String s strings {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        } {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        } sb.append(s) sb.append sb s scanner.close() scanner.close scanner 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 scanner = new Scanner(System.in);
        // String params = scanner.nextLine();
        int numStrings = scanner.nextInt();
        int stringLen = scanner.nextInt(); 
        scanner.nextLine();
        // scanner.next() reads up until \n it won't consume it. You need next Line to pusition the 
        // System.out.println(scanner.nextLine()); // handle of first line \n that is

        List<String> strings = new ArrayList<>();
        for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        }
        // I have the strings now simply sort them and concatenate
        Collections.sort(strings);
        StringBuilder sb = new StringBuilder();
        for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        }                       
        scanner.close();            
        System.out.println(sb.toString());
    }
    
} public class Main {
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // String params = scanner.nextLine();
        int numStrings = scanner.nextInt();
        int stringLen = scanner.nextInt(); 
        scanner.nextLine();
        // scanner.next() reads up until \n it won't consume it. You need next Line to pusition the 
        // System.out.println(scanner.nextLine()); // handle of first line \n that is

        List<String> strings = new ArrayList<>();
        for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        }
        // I have the strings now simply sort them and concatenate
        Collections.sort(strings);
        StringBuilder sb = new StringBuilder();
        for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        }                       
        scanner.close();            
        System.out.println(sb.toString());
    }
    
} Main
import java.util.*;

// Iroha's Strings
public class Main {
    
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // String params = scanner.nextLine();
        int numStrings = scanner.nextInt();
        int stringLen = scanner.nextInt(); 
        scanner.nextLine();
        // scanner.next() reads up until \n it won't consume it. You need next Line to pusition the 
        // System.out.println(scanner.nextLine()); // handle of first line \n that is

        List<String> strings = new ArrayList<>();
        for (int i=0; i<numStrings; i++) {
            String curr = scanner.nextLine();
            // System.out.println("curr" + curr);
            strings.add(curr);
        }
        // I have the strings now simply sort them and concatenate
        Collections.sort(strings);
        StringBuilder sb = new StringBuilder();
        for (String s : strings) {
            // System.out.printf("String:%s, numStrings:%d, stringLen:%d %n", s, numStrings, stringLen);
            sb.append(s);
        }                       
        scanner.close();            
        System.out.println(sb.toString());
    }
    
}