import java.util.*;

class Main {
  public static void main(String[] args) {
    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 demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    }

    Arrays.sort(s);
    for(int j=0;j<N;j++) {
      System.out.print(s[j]);
    }


}
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    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 demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    }

    Arrays.sort(s);
    for(int j=0;j<N;j++) {
      System.out.print(s[j]);
    }


}
} Main public static void main(String[] args) {
    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 demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    }

    Arrays.sort(s);
    for(int j=0;j<N;j++) {
      System.out.print(s[j]);
    }


} 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 demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    }

    Arrays.sort(s);
    for(int j=0;j<N;j++) {
      System.out.print(s[j]);
    }


} 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 demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      String demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    } {
      String demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    } String demostring=sc.next(); demostring sc.next() sc.next sc if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      } demostring.length()==L demostring.length() demostring.length demostring L {
        s[i]=demostring;
      } s[i]=demostring s[i] s i demostring {
        System.out.println("string is not same length");
      } System.out.println("string is not same length") System.out.println System.out System System.out "string is not same length" Arrays.sort(s) Arrays.sort Arrays s for(int j=0;j<N;j++) {
      System.out.print(s[j]);
    } int j=0; int j=0; j 0 j<N j N j++ j++ j {
      System.out.print(s[j]);
    } {
      System.out.print(s[j]);
    } System.out.print(s[j]) System.out.print System.out System System.out s[j] s j String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    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 demostring=sc.next();
      if(demostring.length()==L) {
        s[i]=demostring;
      } else {
        System.out.println("string is not same length");
      }
    }

    Arrays.sort(s);
    for(int j=0;j<N;j++) {
      System.out.print(s[j]);
    }


}
}
