#include <bits/stdc++.h>
using namespace std;
bool cmp(const string& a, const string& b) { return a + b < b + a; }
int main() {
  int n;
  cin >> n;
  vector<string> v(n);
  for (auto& it : v) cin >> it;
  sort(v.begin(), v.end(), cmp);
  for (auto& it : v) cout << it;
  return 0;
}
