#include <bits/stdc++.h>
using namespace std;
const int maxn = 50005;
string s[maxn];
bool cmp(string a, string b) { return a + b < b + a; }
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) cin >> s[i];
    sort(s, s + n, cmp);
    string ans = "";
    for (int i = 0; i < n; i++) ans += s[i];
    cout << ans << endl;
  }
  return 0;
}
