import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int count = scanner.nextInt();
    int length = scanner.nextInt();
    
    List<String> strings = new ArrayList<>();
    for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    }
    
	Collections.sort(strings);
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
      builder.append(string);
    }
    
    System.out.println(builder);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int count = scanner.nextInt();
    int length = scanner.nextInt();
    
    List<String> strings = new ArrayList<>();
    for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    }
    
	Collections.sort(strings);
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
      builder.append(string);
    }
    
    System.out.println(builder);
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int count = scanner.nextInt();
    int length = scanner.nextInt();
    
    List<String> strings = new ArrayList<>();
    for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    }
    
	Collections.sort(strings);
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
      builder.append(string);
    }
    
    System.out.println(builder);
  } main {
    Scanner scanner = new Scanner(System.in);
    int count = scanner.nextInt();
    int length = scanner.nextInt();
    
    List<String> strings = new ArrayList<>();
    for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    }
    
	Collections.sort(strings);
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
      builder.append(string);
    }
    
    System.out.println(builder);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int count = scanner.nextInt(); count scanner.nextInt() scanner.nextInt scanner int length = scanner.nextInt(); length scanner.nextInt() scanner.nextInt scanner List<String> strings = new ArrayList<>(); strings new ArrayList<>() for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    } int ix = 0; int ix = 0; ix 0 ix < count ix count ix++ ix++ ix {
      strings.add(scanner.next());
    } {
      strings.add(scanner.next());
    } strings.add(scanner.next()) strings.add strings scanner.next() scanner.next scanner Collections.sort(strings) Collections.sort Collections strings StringBuilder builder = new StringBuilder(); builder new StringBuilder() for (String string : strings) {
      builder.append(string);
    } String string strings {
      builder.append(string);
    } {
      builder.append(string);
    } builder.append(string) builder.append builder string System.out.println(builder) System.out.println System.out System System.out builder String[] args args public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int count = scanner.nextInt();
    int length = scanner.nextInt();
    
    List<String> strings = new ArrayList<>();
    for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    }
    
	Collections.sort(strings);
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
      builder.append(string);
    }
    
    System.out.println(builder);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int count = scanner.nextInt();
    int length = scanner.nextInt();
    
    List<String> strings = new ArrayList<>();
    for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    }
    
	Collections.sort(strings);
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
      builder.append(string);
    }
    
    System.out.println(builder);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int count = scanner.nextInt();
    int length = scanner.nextInt();
    
    List<String> strings = new ArrayList<>();
    for (int ix = 0; ix < count; ix++) {
      strings.add(scanner.next());
    }
    
	Collections.sort(strings);
    StringBuilder builder = new StringBuilder();
    for (String string : strings) {
      builder.append(string);
    }
    
    System.out.println(builder);
  }
}