#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 5;
bool cmp(string &a, string &b) { return (a + b < b + a); }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  vector<string> v;
  for (long long int i = 0; i < n; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end(), cmp);
  for (auto it : v) cout << it;
}
