#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) #define indexOf(v,x) (find(all(v),x)-v.begin()) int main(){ int n; cin>>n; priority_queue,greater > pq; rep(i,n){ string s; cin>>s; pq.push(s); } string ans; while(!pq.empty()){ string s=pq.top();pq.pop(); if(s.empty())continue; ans+=s[0]; s.erase(s.begin()); pq.push(s); } cout<