#include <bits/stdc++.h>
using namespace std;
const int nmax = 50009;
string t[nmax];
int i, n;
bool compare(string a, string b) {
  int ret;
  if (a.size() > b.size()) {
    swap(a, b);
    ret = 1;
  } else
    ret = 0;
  int n = a.size(), m = b.size();
  for (int i = 0; i < m; ++i) {
    if (a[i % n] < b[i]) return 1 - ret;
    if (a[i % n] > b[i]) return ret;
  }
  if (a + b < b + a) return 1 - ret;
  return ret;
}
int main() {
  cin >> n;
  for (i = 0; i < n; ++i) cin >> t[i];
  sort(t, t + n, compare);
  for (i = 0; i < n; ++i) cout << t[i];
  cout << '\n';
  return 0;
}
