// Created By Jefferson Samuel on 23/08/20 at 2:47 PM

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

class Main {


    static void solve() throws Exception {

        int N = scanInt();
        int L = scanInt();
        ArrayList<String> lis = new ArrayList<>();
        for(int i = 0; i <N;i++)
            lis.add(scanString());
        Collections.sort(lis);
        StringBuilder br = new StringBuilder();
        for( String k : lis)
            br.append(k);

        out.println(br.toString());

    }




    // dont touch this side
    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.StringTokenizer; StringTokenizer java.util import static java.lang.Integer.parseInt; import static java.lang.Integer.parseInt; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Long.parseLong; import static java.lang.Long.parseLong; import static java.lang.System.exit; import static java.lang.System.exit; import static java.lang.System.exit; class Main {


    static void solve() throws Exception {

        int N = scanInt();
        int L = scanInt();
        ArrayList<String> lis = new ArrayList<>();
        for(int i = 0; i <N;i++)
            lis.add(scanString());
        Collections.sort(lis);
        StringBuilder br = new StringBuilder();
        for( String k : lis)
            br.append(k);

        out.println(br.toString());

    }




    // dont touch this side
    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
} Main static BufferedReader in; in static PrintWriter out; out static StringTokenizer tok; tok static void solve() throws Exception {

        int N = scanInt();
        int L = scanInt();
        ArrayList<String> lis = new ArrayList<>();
        for(int i = 0; i <N;i++)
            lis.add(scanString());
        Collections.sort(lis);
        StringBuilder br = new StringBuilder();
        for( String k : lis)
            br.append(k);

        out.println(br.toString());

    } solve {

        int N = scanInt();
        int L = scanInt();
        ArrayList<String> lis = new ArrayList<>();
        for(int i = 0; i <N;i++)
            lis.add(scanString());
        Collections.sort(lis);
        StringBuilder br = new StringBuilder();
        for( String k : lis)
            br.append(k);

        out.println(br.toString());

    } int N = scanInt(); N scanInt() scanInt int L = scanInt(); L scanInt() scanInt ArrayList<String> lis = new ArrayList<>(); lis new ArrayList<>() for(int i = 0; i <N;i++)
            lis.add(scanString()); int i = 0; int i = 0; i 0 i <N i N i++ i++ i lis.add(scanString()); lis.add(scanString()) lis.add lis scanString() scanString Collections.sort(lis) Collections.sort Collections lis StringBuilder br = new StringBuilder(); br new StringBuilder() for( String k : lis)
            br.append(k); String k lis br.append(k); br.append(k) br.append br k out.println(br.toString()) out.println out br.toString() br.toString br // dont touch this side
    static int scanInt() throws IOException {
        return parseInt(scanString());
    } scanInt {
        return parseInt(scanString());
    } return parseInt(scanString()); parseInt(scanString()) parseInt scanString() scanString static long scanLong() throws IOException {
        return parseLong(scanString());
    } scanLong {
        return parseLong(scanString());
    } return parseLong(scanString()); parseLong(scanString()) parseLong scanString() scanString static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    } scanString {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    } while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        } tok == null || !tok.hasMoreTokens() tok == null tok null !tok.hasMoreTokens() tok.hasMoreTokens() tok.hasMoreTokens tok {
            tok = new StringTokenizer(in.readLine());
        } tok = new StringTokenizer(in.readLine()) tok new StringTokenizer(in.readLine()) return tok.nextToken(); tok.nextToken() tok.nextToken tok public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    } main {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    } try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        } Throwable e {
            e.printStackTrace();
            exit(1);
        } e.printStackTrace() e.printStackTrace e exit(1) exit 1 {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } in = new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) out = new PrintWriter(System.out) out new PrintWriter(System.out) solve() solve in.close() in.close in out.close() out.close out String[] args args
// Created By Jefferson Samuel on 23/08/20 at 2:47 PM

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

class Main {


    static void solve() throws Exception {

        int N = scanInt();
        int L = scanInt();
        ArrayList<String> lis = new ArrayList<>();
        for(int i = 0; i <N;i++)
            lis.add(scanString());
        Collections.sort(lis);
        StringBuilder br = new StringBuilder();
        for( String k : lis)
            br.append(k);

        out.println(br.toString());

    }




    // dont touch this side
    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}