#include <bits/stdc++.h>
using namespace std;
bool cmp(string a, string b) { return (a + b < b + a); }
int main() {
  vector<string> x;
  int n;
  char in;
  int idx = 0;
  scanf("%d%c", &n, &in);
  for (int i = 0; i < n; i++) {
    string t;
    cin >> t;
    x.push_back(t);
  }
  sort(x.begin(), x.end(), cmp);
  for (auto itr = x.begin(); itr != x.end(); ++itr) {
    string a = *itr;
    cout << a;
  }
  printf("\n");
}
