#include <bits/stdc++.h>
using namespace std;
const int maxN = 5 * 10000 + 5;
string s[maxN];
int k1, k2;
char mx1, mx2;
bool cmp(string s1, string s2) {
  int n = max(s1.size(), s2.size());
  if (s1.size() > s2.size()) {
    while (s1.size() > s2.size()) {
      s2 += s2;
    }
  } else if (s2.size() > s1.size()) {
    while (s2.size() > s1.size()) s1 += s1;
  }
  s1 += s1;
  s2 += s2;
  for (int i = 0; i < min(s1.size(), s1.size()); i++) {
    if (s1[i] < s2[i]) {
      return true;
    } else if (s2[i] < s1[i]) {
      return false;
    }
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s, s + n, cmp);
  for (int i = 0; i < n; i++) {
    cout << s[i];
  }
  cout << endl;
  return 0;
}
