#include <bits/stdc++.h>
using namespace std;
bool compare(string s1, string s2) { return s1 + s2 < s2 + s1; }
int main() {
  vector<string> words;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    words.push_back(temp);
  }
  sort(words.begin(), words.end(), compare);
  for (auto word : words) {
    cout << word;
  }
  return 0;
}
