
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<unordered_map>
#include<cstdlib>
using namespace std;
typedef long long LL;
const LL N=100010,MOD=998224353,INF=0x7f7f7f7f;
string s[N];
int cnt;
// bool cmp(string& x,string& y){
// string u=x+y,v=y+x;
// return u<v;
// }
bool cmp(string& x,string& y){
int lx=x.size(),ly=y.size();
int sz=max(lx,ly);
for(int i=0;i<sz;i++){
if(i>lx-1){
string u = x+y,v = y+x;
for(int j=0;j<sz+lx;j++){
if(u[j]<v[j]){
return 1;
}else if(u[j]>v[j]){
return 0;
}
}
return 1;
}else if(i>ly-1){
string u = x+y,v = y+x;
for(int j=0;j<sz+ly;j++){
if(u[j]<v[j]){
return 1;
}else if(u[j]>v[j]){
return 0;
}
}
return 1;
}else if(x[i]<y[i]){
return 1;
}else if(x[i]>y[i]){
return 0;
}
}
return 1;
}
int main(){
ios::sync_with_stdio(false),cin.tie(0);
cnt=0;
int n;
cin>>n;
for(int i=0;i<n;i++){
string ss;
cin>>ss;
if(ss.size()>1){
s[cnt]="";
int idx=-1;
for(int j=1;j<ss.size();j++){
if(ss[j-1]>ss[j]){
idx=j-1;
break;
}
}
if(idx==-1){
idx=ss.size()-1;
}
for(int j=0;j<ss.size();j++){
if(j!=idx){
s[cnt]+=ss[j];
}
}
cnt++;
}
// s[cnt++]=ss;
}
sort(s,s+cnt,cmp);
for(int i=0;i<cnt;i++){
cout<<s[i];
}
return 0;
}