#include <bits/stdc++.h>
using namespace std;
int n;
string s[50005];
bool cmp(string &s1, string &s2) {
  string aux1 = s1 + s2, aux2 = s2 + s1;
  return aux1 < aux2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  sort(s, s + n, cmp);
  for (int i = 0; i < n; i++) cout << s[i];
  cout << endl;
  return 0;
}
