#include <bits/stdc++.h>
using namespace std;
bool comp(string a, string b) { return (a + b) < (b + a); }
int n;
string arr[50100];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n, comp);
  for (int i = 0; i < n; i++) cout << arr[i];
  cout << endl;
}
