#include <bits/stdc++.h>
using namespace std;
vector<string> arr;
bool compare_string(string a, string b) {
  string p = a + b;
  string q = b + a;
  return lexicographical_compare(p.begin(), p.end(), q.begin(), q.end());
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string t;
    cin >> t;
    arr.push_back(t);
  }
  sort(arr.begin(), arr.end(), compare_string);
  string res = "";
  for (int i = 0; i < n; i++) {
    res += arr[i];
  }
  cout << res << endl;
  return 0;
}
