
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * @author yoshizaki
 *
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int count = scanner.nextInt();
        int len = scanner.nextInt();
        List<String> moji = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        }
        Collections.sort(moji);
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        }
        System.out.println(sb.toString());
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int count = scanner.nextInt();
        int len = scanner.nextInt();
        List<String> moji = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        }
        Collections.sort(moji);
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        }
        System.out.println(sb.toString());
    }
} Main public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int count = scanner.nextInt();
        int len = scanner.nextInt();
        List<String> moji = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        }
        Collections.sort(moji);
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        }
        System.out.println(sb.toString());
    } main {
        Scanner scanner= new Scanner(System.in);
        int count = scanner.nextInt();
        int len = scanner.nextInt();
        List<String> moji = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        }
        Collections.sort(moji);
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        }
        System.out.println(sb.toString());
    } Scanner scanner= new Scanner(System.in); scanner new Scanner(System.in) int count = scanner.nextInt(); count scanner.nextInt() scanner.nextInt scanner int len = scanner.nextInt(); len scanner.nextInt() scanner.nextInt scanner List<String> moji = new ArrayList<String>(); moji new ArrayList<String>() for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        } int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
            moji.add(scanner.next());
        } {
            moji.add(scanner.next());
        } moji.add(scanner.next()) moji.add moji scanner.next() scanner.next scanner Collections.sort(moji) Collections.sort Collections moji StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        } int i = 0 ; int i = 0 ; i 0 i < count i count i++ i++ i {
            sb.append(moji.get(i));
        } {
            sb.append(moji.get(i));
        } sb.append(moji.get(i)) sb.append sb moji.get(i) moji.get moji i System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int count = scanner.nextInt();
        int len = scanner.nextInt();
        List<String> moji = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        }
        Collections.sort(moji);
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        }
        System.out.println(sb.toString());
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int count = scanner.nextInt();
        int len = scanner.nextInt();
        List<String> moji = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        }
        Collections.sort(moji);
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        }
        System.out.println(sb.toString());
    }
} Main

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * @author yoshizaki
 *
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int count = scanner.nextInt();
        int len = scanner.nextInt();
        List<String> moji = new ArrayList<String>();
        for (int i = 0; i < count; i++) {
            moji.add(scanner.next());
        }
        Collections.sort(moji);
        StringBuilder sb = new StringBuilder();
        for(int i = 0 ; i < count ; i++) {
            sb.append(moji.get(i));
        }
        System.out.println(sb.toString());
    }
}
