#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double PI = acos((long double)-1);
bool compare(string a, string b) { return a + b < b + a; }
void solve() {
  int n;
  cin >> n;
  vector<string> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort((arr).begin(), (arr).end(), compare);
  for (string str : arr) {
    cout << str;
  }
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
