#include <bits/stdc++.h>
using namespace std;
int ar[] = {0, 0, 1, -1};
int ac[] = {1, -1, 0, 0};
int n, m;
vector<string> ve;
bool ok(string s, string t) {
  string s1 = s + t;
  string s2 = t + s;
  return s1 < s2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(6);
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    ve.push_back(s);
  }
  sort(ve.begin(), ve.end(), ok);
  for (auto x : ve) cout << x;
}
