#include"bits/stdc++.h" //#include using namespace std; #define print(x) cout< PI; typedef pair V; const ll mod = 10000000000; int main() { int n; string s[52]; cin >> n; REP(i, n) { cin >> s[i];} string ans=""; while (true) { char m='z'; int mi=-1; REP(i, n) { if (s[i].empty())continue; if (m == 'z'||m > s[i].front()) { m = s[i].front(); mi = i; } else if (m == s[i].front()) { int j = 0; while (true) { if (j == s[mi].size() || j == s[i].size())break; if (s[mi][j] != s[i][j]) { mi = s[mi][j] > s[i][j] ? i:mi; break; } j++; } } } if (mi == -1)break; ans += m; s[mi].erase(s[mi].begin() + 0); } print(ans); return 0; }