#include <bits/stdc++.h>
using namespace std;
int n;
vector<string> a;
bool comp(string p, string t) {
  string s1 = p, s2 = t;
  s1.append(t), s2.append(p);
  return (s1 < s2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end(), comp);
  for (int i = 0; i < n; ++i) cout << a[i];
}
