#include <bits/stdc++.h>
using namespace std;
string x;
struct record {
  string y;
  record() {}
  record(string y) { this->y = y; }
  bool operator<(const record& p) const { return (p.y + y) > (y + p.y); }
};
vector<record> v;
int main() {
  long long n, i;
  cin >> n;
  while (n--) {
    cin >> x;
    v.push_back(record(x));
  }
  if (v.size() == 1)
    cout << v[0].y << "\n";
  else {
    string x, y;
    sort(v.begin(), v.end());
    for (i = 0; i < v.size(); i++) {
      cout << v[i].y << "";
    }
  }
}
