#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846264;
bool compare(string a, string b) { return (a + b < b + a); }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  clock_t clk = clock();
  ;
  long long n;
  cin >> n;
  string s[n];
  for (long long i = 0; i < n; i++) cin >> s[i];
  sort(s, s + n, compare);
  for (long long i = 0; i < n; i++) cout << s[i];
  cout << endl;
}
