#include <bits/stdc++.h>
using namespace std;
int n;
vector<string> v;
bool compare(const string &a, const string &b) { return a + b < b + a; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end(), compare);
  for (int i = 0; i < v.size(); ++i) cout << v[i];
  cout << '\n';
  return 0;
}
