#include <bits/stdc++.h>
using namespace std;
struct st {
  bool operator()(string a, string b) { return a + b < b + a; }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  int n;
  string s;
  multiset<string, st> S;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    S.insert(s);
  }
  for (auto x : S) cout << x;
  return 0;
}
