import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    
    List<String> ary = new ArrayList();

    for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    }
    
    Collections.sort(ary);
    
    String res = String.join("",ary);

    System.out.println(res);
 
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    
    List<String> ary = new ArrayList();

    for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    }
    
    Collections.sort(ary);
    
    String res = String.join("",ary);

    System.out.println(res);
 
  }
} Main public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    
    List<String> ary = new ArrayList();

    for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    }
    
    Collections.sort(ary);
    
    String res = String.join("",ary);

    System.out.println(res);
 
  } main {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    
    List<String> ary = new ArrayList();

    for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    }
    
    Collections.sort(ary);
    
    String res = String.join("",ary);

    System.out.println(res);
 
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int L = sc.nextInt(); L sc.nextInt() sc.nextInt sc List<String> ary = new ArrayList(); ary new ArrayList() for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    } {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    } String str = sc.next(); str sc.next() sc.next sc if(str.length() == L) {
            ary.add(str);
        } str.length() == L str.length() str.length str L {
            ary.add(str);
        } ary.add(str) ary.add ary str Collections.sort(ary) Collections.sort Collections ary String res = String.join("",ary); res String.join("",ary) String.join String "" ary System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    
    List<String> ary = new ArrayList();

    for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    }
    
    Collections.sort(ary);
    
    String res = String.join("",ary);

    System.out.println(res);
 
  }
} public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    
    List<String> ary = new ArrayList();

    for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    }
    
    Collections.sort(ary);
    
    String res = String.join("",ary);

    System.out.println(res);
 
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    
    List<String> ary = new ArrayList();

    for(int i = 0; i < N; i++) {
        String str = sc.next();
        
        if(str.length() == L) {
            ary.add(str);
        }
    }
    
    Collections.sort(ary);
    
    String res = String.join("",ary);

    System.out.println(res);
 
  }
}
