#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
long long ii = 1;
bool cmp(string a, string b) { return (a + b < b + a); }
void solve() {
  long long n;
  cin >> n;
  vector<string> v;
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end(), cmp);
  for (long long i = 0; i < n; i++) cout << v[i];
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long TestCase;
  TestCase = 1;
  while (TestCase--) solve();
  return 0;
}
