import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int stringCount = sc.nextInt();
    int stringLength = sc.nextInt();
    String blank = sc.nextLine();
    String[] array = new String[stringCount];
    for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    }
    
	Arrays.sort(array);
    String result = "";
    for(String val : array){
      result += val;
    }
    
    System.out.println(result);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int stringCount = sc.nextInt();
    int stringLength = sc.nextInt();
    String blank = sc.nextLine();
    String[] array = new String[stringCount];
    for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    }
    
	Arrays.sort(array);
    String result = "";
    for(String val : array){
      result += val;
    }
    
    System.out.println(result);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int stringCount = sc.nextInt();
    int stringLength = sc.nextInt();
    String blank = sc.nextLine();
    String[] array = new String[stringCount];
    for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    }
    
	Arrays.sort(array);
    String result = "";
    for(String val : array){
      result += val;
    }
    
    System.out.println(result);
  } main {
    Scanner sc = new Scanner(System.in);
    int stringCount = sc.nextInt();
    int stringLength = sc.nextInt();
    String blank = sc.nextLine();
    String[] array = new String[stringCount];
    for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    }
    
	Arrays.sort(array);
    String result = "";
    for(String val : array){
      result += val;
    }
    
    System.out.println(result);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int stringCount = sc.nextInt(); stringCount sc.nextInt() sc.nextInt sc int stringLength = sc.nextInt(); stringLength sc.nextInt() sc.nextInt sc String blank = sc.nextLine(); blank sc.nextLine() sc.nextLine sc String[] array = new String[stringCount]; array new String[stringCount] stringCount for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    } int i = 0; int i = 0; i 0 i < stringCount i stringCount i++ i++ i {
      array[i] = sc.nextLine();
    } {
      array[i] = sc.nextLine();
    } array[i] = sc.nextLine() array[i] array i sc.nextLine() sc.nextLine sc Arrays.sort(array) Arrays.sort Arrays array String result = ""; result "" for(String val : array){
      result += val;
    } String val array {
      result += val;
    } {
      result += val;
    } result += val result val 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) {
    Scanner sc = new Scanner(System.in);
    int stringCount = sc.nextInt();
    int stringLength = sc.nextInt();
    String blank = sc.nextLine();
    String[] array = new String[stringCount];
    for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    }
    
	Arrays.sort(array);
    String result = "";
    for(String val : array){
      result += val;
    }
    
    System.out.println(result);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int stringCount = sc.nextInt();
    int stringLength = sc.nextInt();
    String blank = sc.nextLine();
    String[] array = new String[stringCount];
    for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    }
    
	Arrays.sort(array);
    String result = "";
    for(String val : array){
      result += val;
    }
    
    System.out.println(result);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int stringCount = sc.nextInt();
    int stringLength = sc.nextInt();
    String blank = sc.nextLine();
    String[] array = new String[stringCount];
    for(int i = 0; i < stringCount;i++){
      array[i] = sc.nextLine();
    }
    
	Arrays.sort(array);
    String result = "";
    for(String val : array){
      result += val;
    }
    
    System.out.println(result);
  }
}