#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e6 + 1;
const int TMXN = 1e6 * 4 + 1;
const long long INFL = 1e18;
int n, p;
string second[MXN];
bool cmp(string a, string b) { return (a + b) < (b + a); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> second[i];
  }
  sort(second + 1, second + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    cout << second[i];
  }
  return 0;
}
