import java.util.*;
import java.lang.StringBuilder;

public class Main{
	public static void main(String[] args){
      
  		Scanner sc = new Scanner(System.in);
        
        String[] line = sc.nextLine().split(" ");

        int num = Integer.parseInt(line[0]);
        int length = Integer.parseInt(line[1]);
        
        String[] arr = new String[num];

        for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        }

        Arrays.sort(arr);

        StringBuilder result = new StringBuilder();
        for(int i = 0;i < num;i++){
            result.append(arr[i]);
        }

        System.out.println(result.toString());
    }
} import java.util.*; util.* java import java.lang.StringBuilder; StringBuilder java.lang public class Main{
	public static void main(String[] args){
      
  		Scanner sc = new Scanner(System.in);
        
        String[] line = sc.nextLine().split(" ");

        int num = Integer.parseInt(line[0]);
        int length = Integer.parseInt(line[1]);
        
        String[] arr = new String[num];

        for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        }

        Arrays.sort(arr);

        StringBuilder result = new StringBuilder();
        for(int i = 0;i < num;i++){
            result.append(arr[i]);
        }

        System.out.println(result.toString());
    }
} Main public static void main(String[] args){
      
  		Scanner sc = new Scanner(System.in);
        
        String[] line = sc.nextLine().split(" ");

        int num = Integer.parseInt(line[0]);
        int length = Integer.parseInt(line[1]);
        
        String[] arr = new String[num];

        for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        }

        Arrays.sort(arr);

        StringBuilder result = new StringBuilder();
        for(int i = 0;i < num;i++){
            result.append(arr[i]);
        }

        System.out.println(result.toString());
    } main {
      
  		Scanner sc = new Scanner(System.in);
        
        String[] line = sc.nextLine().split(" ");

        int num = Integer.parseInt(line[0]);
        int length = Integer.parseInt(line[1]);
        
        String[] arr = new String[num];

        for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        }

        Arrays.sort(arr);

        StringBuilder result = new StringBuilder();
        for(int i = 0;i < num;i++){
            result.append(arr[i]);
        }

        System.out.println(result.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int num = Integer.parseInt(line[0]); num Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int length = Integer.parseInt(line[1]); length Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 String[] arr = new String[num]; arr new String[num] num for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {

            arr[i] = sc.nextLine();

        } {

            arr[i] = sc.nextLine();

        } arr[i] = sc.nextLine() arr[i] arr i sc.nextLine() sc.nextLine sc Arrays.sort(arr) Arrays.sort Arrays arr StringBuilder result = new StringBuilder(); result new StringBuilder() for(int i = 0;i < num;i++){
            result.append(arr[i]);
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            result.append(arr[i]);
        } {
            result.append(arr[i]);
        } result.append(arr[i]) result.append result arr[i] arr i System.out.println(result.toString()) System.out.println System.out System System.out result.toString() result.toString result String[] args args public class Main{
	public static void main(String[] args){
      
  		Scanner sc = new Scanner(System.in);
        
        String[] line = sc.nextLine().split(" ");

        int num = Integer.parseInt(line[0]);
        int length = Integer.parseInt(line[1]);
        
        String[] arr = new String[num];

        for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        }

        Arrays.sort(arr);

        StringBuilder result = new StringBuilder();
        for(int i = 0;i < num;i++){
            result.append(arr[i]);
        }

        System.out.println(result.toString());
    }
} public class Main{
	public static void main(String[] args){
      
  		Scanner sc = new Scanner(System.in);
        
        String[] line = sc.nextLine().split(" ");

        int num = Integer.parseInt(line[0]);
        int length = Integer.parseInt(line[1]);
        
        String[] arr = new String[num];

        for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        }

        Arrays.sort(arr);

        StringBuilder result = new StringBuilder();
        for(int i = 0;i < num;i++){
            result.append(arr[i]);
        }

        System.out.println(result.toString());
    }
} Main
import java.util.*;
import java.lang.StringBuilder;

public class Main{
	public static void main(String[] args){
      
  		Scanner sc = new Scanner(System.in);
        
        String[] line = sc.nextLine().split(" ");

        int num = Integer.parseInt(line[0]);
        int length = Integer.parseInt(line[1]);
        
        String[] arr = new String[num];

        for(int i = 0;i < num;i++){

            arr[i] = sc.nextLine();

        }

        Arrays.sort(arr);

        StringBuilder result = new StringBuilder();
        for(int i = 0;i < num;i++){
            result.append(arr[i]);
        }

        System.out.println(result.toString());
    }
}