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();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  }
} 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();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  }
} Main public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  } main {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int L = sc.nextInt();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  } 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 String[] S = new String[N]; S new String[N] N for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    } {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    } String token = sc.next(); token sc.next() sc.next sc if(token.length() == L) S[i] =  token; token.length() == L token.length() token.length token L S[i] =  token S[i] S i token Arrays.sort(S) Arrays.sort Arrays S System.out.println(String.join("",S)) System.out.println System.out System System.out String.join("",S) String.join String "" S 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();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  }
} 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();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  }
} 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();
    String[] S = new String[N];
    
    for(int i = 0; i < N; i++) {
        String token = sc.next();
        if(token.length() == L) S[i] =  token;
    }
    Arrays.sort(S);
    System.out.println(String.join("",S));
  }
}
