#include <bits/stdc++.h>
using namespace std;
string s[60000];
bool cmp(const string& a, const string& b) { return (a + b) < (b + a); }
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 << "\n";
  return 0;
}
