#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  short negative = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') negative = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  x *= negative;
}
long long quickpower(long long n, long long k) {
  long long ans = 1;
  while (k) {
    if (k % 2) {
      ans *= n;
      ans %= 1000000007;
    }
    n *= n;
    n %= 1000000007;
    k /= 2;
  }
  return ans;
}
string int_to_string(int n) {
  string s = "";
  while (n) {
    int now = n % 10;
    s += now + '0';
    n /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}
int string_to_int(string s) {
  int n = 0;
  for (int i = 0, _n = s.size(); i < s.size(); i++) {
    n *= 10;
    n += s[i] - '0';
  }
  return n;
}
bool cmp(string s, string k) {
  if (s.size() == k.size()) return s < k;
  string s1 = s + k, s2 = k + s;
  if (s1 < s2) return 1;
  return 0;
}
int n;
string a[50100];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0, _n = n; i < n; i++) cin >> a[i];
  sort(a, a + n, cmp);
  for (int i = 0, _n = n; i < n; i++) cout << a[i];
  cout << endl;
  return 0;
}
