#include <bits/stdc++.h>
using namespace std;
bool cmp(string str1, string str2) {
  string stra = str1 + str2;
  string strb = str2 + str1;
  if (stra < strb)
    return true;
  else
    return false;
}
int main() {
  string str[50005];
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) cin >> str[i];
    sort(str, str + n, cmp);
    for (int i = 0; i < n; i++) cout << str[i];
    cout << endl;
  }
  return 0;
}
