#include <bits/stdc++.h>
using namespace std;
const int maxn = 50000 + 10;
string s[maxn];
bool cmp(const string &a, const string &b) { return a + b < b + a; }
int main() {
  int n;
  scanf("%d", &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];
  printf("\n");
  return 0;
}
