#include <bits/stdc++.h>
using namespace std;
string rec(string k, string st) {
  string ans = k + st;
  string ans1 = st + k;
  string ans2 = min(ans, ans1);
  return ans2;
}
bool chfunc(string &a, string &b) {
  if (a + b > b + a)
    return true;
  else
    return false;
}
int main() {
  int n;
  cin >> n;
  vector<string> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end(), chfunc);
  string st = v[0];
  for (int i = 1; i < n; i++) {
    st = rec(v[i], st);
  }
  cout << st << "\n";
}
