#include <bits/stdc++.h>
using namespace std;
bool comp(pair<string, long long int> lf, pair<string, long long int> rg) {
  return (lf.first + rg.first < rg.first + lf.first);
}
int main() {
  long long int n;
  cin >> n;
  vector<pair<string, long long int> > as(n, make_pair("", 0));
  vector<long long> len(n);
  for (int i = 0; i < n; ++i) {
    string str;
    cin >> str;
    as[i].first = str;
    long long int tmp = 50 - (as[i].first).length();
    as[i].second = (as[i].first).length();
  }
  sort((as).begin(), (as).end(), comp);
  for (auto p : as) {
    if (0) cerr << p.first << " " << p.second << endl;
  }
  string res = "";
  for (int i = 0; i < n; ++i) {
    res = res + (as[i].first).substr(0, as[i].second);
  }
  cout << res << endl;
  return 0;
}
