import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int L = Integer.parseInt(S[1]);
    List<String> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    }
    Collections.sort(list);
    String ans = "";
    for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    }
    
    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int L = Integer.parseInt(S[1]);
    List<String> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    }
    Collections.sort(list);
    String ans = "";
    for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    }
    
    System.out.println(ans);
  }
} Main public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int L = Integer.parseInt(S[1]);
    List<String> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    }
    Collections.sort(list);
    String ans = "";
    for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    }
    
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int L = Integer.parseInt(S[1]);
    List<String> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    }
    Collections.sort(list);
    String ans = "";
    for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    }
    
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] S = sc.nextLine().split(" "); S sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int N = Integer.parseInt(S[0]); N Integer.parseInt(S[0]) Integer.parseInt Integer S[0] S 0 int L = Integer.parseInt(S[1]); L Integer.parseInt(S[1]) Integer.parseInt Integer S[1] S 1 List<String> list = new ArrayList<>(); list new ArrayList<>() for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      list.add(sc.nextLine());
    } {
      list.add(sc.nextLine());
    } list.add(sc.nextLine()) list.add list sc.nextLine() sc.nextLine sc Collections.sort(list) Collections.sort Collections list String ans = ""; ans "" for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      ans = ans + list.get(i);
    } {
      ans = ans + list.get(i);
    } ans = ans + list.get(i) ans ans + list.get(i) ans list.get(i) list.get list i System.out.println(ans) System.out.println System.out System System.out ans String[]args args public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int L = Integer.parseInt(S[1]);
    List<String> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    }
    Collections.sort(list);
    String ans = "";
    for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    }
    
    System.out.println(ans);
  }
} public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int L = Integer.parseInt(S[1]);
    List<String> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    }
    Collections.sort(list);
    String ans = "";
    for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    }
    
    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String[] S = sc.nextLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int L = Integer.parseInt(S[1]);
    List<String> list = new ArrayList<>();
    for(int i = 0; i < N; i++){
      list.add(sc.nextLine());
    }
    Collections.sort(list);
    String ans = "";
    for(int i = 0; i < N; i++){
      ans = ans + list.get(i);
    }
    
    System.out.println(ans);
  }
}