import std.stdio,std.array,std.conv,std.string,std.algorithm;

void main(){
    string[] a = split(readln());
    int n =  to!int(a[0]);

    string[] s = new string[n];
    for(int i=0;i<n;i++){
        s[i] = chomp(readln());
    }

    string[] ans = new string[n];
    string min = s[0];
    string tmp = s[0];
    int count = 0;
    for(int j=0;j<s.length;j++){
        for(int i=0;i<s.length;i++){
            if(min >= s[i]){
                min = s[i];
                count = i;
            }
        }
        s = s.remove(count);
        ans[j] = min;
        min = tmp;
        count = 0;
    }
    
    for(int i=0;i<n;i++){
        write(ans[i]);
    }
    write(s[0]);
}
