#include <bits/stdc++.h>
using namespace std;
int dir[] = {0, 1, 0, -1, 1, 0, -1, 0};
bool comp(const string &s, const string &t) { return s + t < t + s; }
void solve() {
  int n;
  vector<string> s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string st;
    cin >> st;
    s.emplace_back(st);
  }
  sort(s.begin(), s.end(), comp);
  for (int i = 0; i < n; i++) cout << s[i];
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  int t = 1;
  for (int cn = 1; cn <= t; cn++) {
    solve();
  }
  return 0;
}
