import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    String[] s = new String[n];

    for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    }
    
    Arrays.sort(s);
    
    for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    }
    
    System.out.println();
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.Arrays; Arrays java.util public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    String[] s = new String[n];

    for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    }
    
    Arrays.sort(s);
    
    for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    }
    
    System.out.println();
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    String[] s = new String[n];

    for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    }
    
    Arrays.sort(s);
    
    for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    }
    
    System.out.println();
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    String[] s = new String[n];

    for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    }
    
    Arrays.sort(s);
    
    for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    }
    
    System.out.println();
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String[] str = in.readLine().split(" "); str in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int n = Integer.parseInt(str[0]); n Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int l = Integer.parseInt(str[1]); l Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 String[] s = new String[n]; s new String[n] n for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      s[i] = in.readLine();
    } {
      s[i] = in.readLine();
    } s[i] = in.readLine() s[i] s i in.readLine() in.readLine in Arrays.sort(s) Arrays.sort Arrays s for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      System.out.print(s[i]);
    } {
      System.out.print(s[i]);
    } System.out.print(s[i]) System.out.print System.out System System.out s[i] s i System.out.println() System.out.println System.out System System.out String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    String[] s = new String[n];

    for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    }
    
    Arrays.sort(s);
    
    for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    }
    
    System.out.println();
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    String[] s = new String[n];

    for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    }
    
    Arrays.sort(s);
    
    for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    }
    
    System.out.println();
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int l = Integer.parseInt(str[1]);
    String[] s = new String[n];

    for(int i=0; i<n; i++) {
      s[i] = in.readLine();
    }
    
    Arrays.sort(s);
    
    for(int i=0; i<n; i++) {
      System.out.print(s[i]);
    }
    
    System.out.println();
  }
}