import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int m = sc.nextInt();

        String[] arr = new String[n];
        for (int i=0; i<n; i++) arr[i] = sc.next();

        Arrays.sort(arr);

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++) sb.append(arr[i]);

        System.out.println(sb.toString());

    }

}
 import java.util.*; util.* java public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int m = sc.nextInt();

        String[] arr = new String[n];
        for (int i=0; i<n; i++) arr[i] = sc.next();

        Arrays.sort(arr);

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++) sb.append(arr[i]);

        System.out.println(sb.toString());

    }

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

        int n = sc.nextInt();
        int m = sc.nextInt();

        String[] arr = new String[n];
        for (int i=0; i<n; i++) arr[i] = sc.next();

        Arrays.sort(arr);

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++) sb.append(arr[i]);

        System.out.println(sb.toString());

    } run {

        int n = sc.nextInt();
        int m = sc.nextInt();

        String[] arr = new String[n];
        for (int i=0; i<n; i++) arr[i] = sc.next();

        Arrays.sort(arr);

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++) sb.append(arr[i]);

        System.out.println(sb.toString());

    } int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc String[] arr = new String[n]; arr new String[n] n for (int i=0; i<n; i++) arr[i] = sc.next(); int i=0; int i=0; i 0 i<n i n i++ i++ i arr[i] = sc.next(); arr[i] = sc.next() arr[i] arr i sc.next() sc.next sc Arrays.sort(arr) Arrays.sort Arrays arr StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i=0; i<n; i++) sb.append(arr[i]); int i=0; int i=0; i 0 i<n i n i++ i++ i sb.append(arr[i]); sb.append(arr[i]) sb.append sb arr[i] arr i System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int m = sc.nextInt();

        String[] arr = new String[n];
        for (int i=0; i<n; i++) arr[i] = sc.next();

        Arrays.sort(arr);

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++) sb.append(arr[i]);

        System.out.println(sb.toString());

    }

} public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int m = sc.nextInt();

        String[] arr = new String[n];
        for (int i=0; i<n; i++) arr[i] = sc.next();

        Arrays.sort(arr);

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++) sb.append(arr[i]);

        System.out.println(sb.toString());

    }

} Main
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int m = sc.nextInt();

        String[] arr = new String[n];
        for (int i=0; i<n; i++) arr[i] = sc.next();

        Arrays.sort(arr);

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++) sb.append(arr[i]);

        System.out.println(sb.toString());

    }

}

