

import java.io.*;
import java.text.*;
import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000000000000000");
        long max = 1000000000000000l, min = -10000000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        long ncr(long n, long r) {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        }

        long modPow(long x, long y) {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        }

        int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }

        final int maxn = 5005;

        void solve() throws IOException {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        }
    }
} import java.io.*; io.* java import java.text.*; text.* java import java.util.*; util.* java public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000000000000000");
        long max = 1000000000000000l, min = -10000000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        long ncr(long n, long r) {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        }

        long modPow(long x, long y) {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        }

        int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }

        final int maxn = 5005;

        void solve() throws IOException {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        }
    }
} Main static InputReader sc = new InputReader(System.in); sc new InputReader(System.in) static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) static int inf = 5000013; inf 5000013 public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    } main {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    } solver s = new solver(); s new solver() int t = 1; t 1 while (t > 0) {
            s.solve();
            t--;
        } t > 0 t 0 {
            s.solve();
            t--;
        } s.solve() s.solve s t-- t out.close() out.close out String[] args args static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    } InputReader public BufferedReader br; br public StringTokenizer token; token public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        } InputReader {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        } br = new BufferedReader(new InputStreamReader(stream), 32768) br new BufferedReader(new InputStreamReader(stream), 32768) token = null token null InputStream stream stream public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        } sn {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        } while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } token == null || !token.hasMoreTokens() token == null token null !token.hasMoreTokens() token.hasMoreTokens() token.hasMoreTokens token {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    token = new StringTokenizer(br.readLine());
                } token = new StringTokenizer(br.readLine()) token new StringTokenizer(br.readLine()) return token.nextToken(); token.nextToken() token.nextToken token public int ni() {
            return Integer.parseInt(sn());
        } ni {
            return Integer.parseInt(sn());
        } return Integer.parseInt(sn()); Integer.parseInt(sn()) Integer.parseInt Integer sn() sn public String snl() throws IOException {
            return br.readLine();
        } snl {
            return br.readLine();
        } return br.readLine(); br.readLine() br.readLine br public long nlo() {
            return Long.parseLong(sn());
        } nlo {
            return Long.parseLong(sn());
        } return Long.parseLong(sn()); Long.parseLong(sn()) Long.parseLong Long sn() sn public double nd() {
            return Double.parseDouble(sn());
        } nd {
            return Double.parseDouble(sn());
        } return Double.parseDouble(sn()); Double.parseDouble(sn()) Double.parseDouble Double sn() sn public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        } na {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        } int a[] = new int[n]; a new int[n] n for (int i = 0; i < n; i++)
                a[i] = sc.ni(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = sc.ni(); a[i] = sc.ni() a[i] a i sc.ni() sc.ni sc return a; a int n n public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        } nal {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        } long a[] = new long[n]; a new long[n] n for (int i = 0; i < n; i++)
                a[i] = sc.nlo(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = sc.nlo(); a[i] = sc.nlo() a[i] a i sc.nlo() sc.nlo sc return a; a int n n static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000000000000000");
        long max = 1000000000000000l, min = -10000000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        long ncr(long n, long r) {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        }

        long modPow(long x, long y) {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        }

        int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }

        final int maxn = 5005;

        void solve() throws IOException {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        }
    } solver DecimalFormat df = new DecimalFormat("0.00000000000000000000"); df new DecimalFormat("0.00000000000000000000") long max = 1000000000000000l max 1000000000000000l min = -10000000000000000l; min -10000000000000000l 10000000000000000l long mod = (long) 1e9 + 7; mod (long) 1e9 + 7 (long) 1e9 7 final int maxn = 5005; maxn 5005 long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        } pro {
            return (a % mod * b % mod) % mod;
        } return (a % mod * b % mod) % mod; (a % mod * b % mod) % mod (a % mod * b % mod) a % mod * b a % mod a mod b mod mod long a a long b b long add(long a, long b) {
            return (a + b) % mod;
        } add {
            return (a + b) % mod;
        } return (a + b) % mod; (a + b) % mod (a + b) a b mod long a a long b b long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        } sub {
            return ((a % mod - b % mod) + mod) % mod;
        } return ((a % mod - b % mod) + mod) % mod; ((a % mod - b % mod) + mod) % mod ((a % mod - b % mod) + mod) (a % mod - b % mod) a % mod a mod b % mod b mod mod mod long a a long b b long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        } ncr3 {
            return (n * (n - 1) * (n - 2)) / 6l;
        } return (n * (n - 1) * (n - 2)) / 6l; (n * (n - 1) * (n - 2)) / 6l (n * (n - 1) * (n - 2)) n * (n - 1) * (n - 2) n (n - 1) n 1 (n - 2) n 2 6l long n n long ncr2(long n) {
            return n * (n - 1) / 2l;
        } ncr2 {
            return n * (n - 1) / 2l;
        } return n * (n - 1) / 2l; n * (n - 1) / 2l n * (n - 1) n (n - 1) n 1 2l long n n long ncr(long n, long r) {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        } ncr {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        } double res = 1.0; res 1.0 for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            } long i = n, j = r; long i = n i n j = r; j r i > (n - r) i (n - r) n r i--, j-- i-- i j-- j {
                res *= (i * 1.0) / j;
            } {
                res *= (i * 1.0) / j;
            } res *= (i * 1.0) / j res (i * 1.0) / j (i * 1.0) i 1.0 j return (long) Math.ceil(res); (long) Math.ceil(res) Math.ceil Math res long n n long r r long modPow(long x, long y) {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        } modPow {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        } long res = 1; res 1 x = x % mod x x % mod x mod while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            } y > 0 y 0 {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            } if (y % 2 != 0)
                    res = pro(res, x); y % 2 != 0 y % 2 y 2 0 res = pro(res, x) res pro(res, x) pro res x x = pro(x, x) x pro(x, x) pro x x y = y >> 1 y y >> 1 y 1 return res; res long x x long y y int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        } gcd {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        } if (b == 0)
                return a; b == 0 b 0 return a; a return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b int a a int b b void solve() throws IOException {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        } solve {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        } int n = sc.ni(); n sc.ni() sc.ni sc int l = sc.ni(); l sc.ni() sc.ni sc String a[] = new String[n]; a new String[n] n for (int i = 0; i < n; i++)
                a[i] = sc.sn(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = sc.sn(); a[i] = sc.sn() a[i] a i sc.sn() sc.sn sc Arrays.sort(a) Arrays.sort Arrays a StringBuilder ans = new StringBuilder(); ans new StringBuilder() for (String h : a)
                ans.append(h); String h a ans.append(h); ans.append(h) ans.append ans h out.println(ans) out.println out ans public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000000000000000");
        long max = 1000000000000000l, min = -10000000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        long ncr(long n, long r) {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        }

        long modPow(long x, long y) {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        }

        int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }

        final int maxn = 5005;

        void solve() throws IOException {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        }
    }
} public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000000000000000");
        long max = 1000000000000000l, min = -10000000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        long ncr(long n, long r) {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        }

        long modPow(long x, long y) {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        }

        int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }

        final int maxn = 5005;

        void solve() throws IOException {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        }
    }
} Main


import java.io.*;
import java.text.*;
import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000000000000000");
        long max = 1000000000000000l, min = -10000000000000000l;
        long mod = (long) 1e9 + 7;

        long pro(long a, long b) {
            return (a % mod * b % mod) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        long sub(long a, long b) {
            return ((a % mod - b % mod) + mod) % mod;
        }

        long ncr3(long n) {
            return (n * (n - 1) * (n - 2)) / 6l;
        }

        long ncr2(long n) {
            return n * (n - 1) / 2l;
        }

        long ncr(long n, long r) {
            double res = 1.0;
            for (long i = n, j = r; i > (n - r); i--, j--) {
                res *= (i * 1.0) / j;
            }
            return (long) Math.ceil(res);
        }

        long modPow(long x, long y) {
            long res = 1;
            x = x % mod;
            while (y > 0) {
                if (y % 2 != 0)
                    res = pro(res, x);
                x = pro(x, x);
                y = y >> 1;
            }
            return res;
        }

        int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }

        final int maxn = 5005;

        void solve() throws IOException {
            int n = sc.ni();
            int l = sc.ni();
            String a[] = new String[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.sn();
            Arrays.sort(a);
            StringBuilder ans = new StringBuilder();
            for (String h : a)
                ans.append(h);
            out.println(ans);
        }
    }
}