#include <bits/stdc++.h>
using namespace std;
const long long mxN = 5e5 + 5;
const long long INF = 1e18 + 7;
long long N;
string S[mxN];
bool comp(string &a, string &b) { return a + b < b + a; }
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  for (long long i = 1; i <= N; i++) cin >> S[i];
  sort(S + 1, S + N + 1, comp);
  for (long long i = 1; i <= N; i++) cout << S[i];
  return 0;
}
