#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector,Ofast")
using namespace std;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long N = 2e5 + 5;
const long double pi = acos(-1);
const long long INF = (1LL << 60);
long long n;
string s;
vector<string> v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  while (cin >> s) v.push_back(s);
  sort(v.begin(), v.end(), [](string a, string b) { return (a + b < b + a); });
  for (auto i : v) cout << i;
  cout << "\n";
  return 0;
}
