#include <bits/stdc++.h>
using namespace std;
bool cmp(string a, string b) {
  string c = a + b;
  string d = b + a;
  return c < d;
}
int main() {
  int n;
  cin >> n;
  vector<string> v;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end(), cmp);
  for (int i = 0; i < n; i++) cout << v[i];
}
