#include <bits/stdc++.h>
using namespace std;
inline long long IN() {
  long long x = 0;
  int ch = getchar(), f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void OUT(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10)
    OUT(x / 10), putchar(x % 10 + '0');
  else
    putchar(x + '0');
}
int n;
char ch[55];
string s[50005];
bool cmp(string a, string b) { return a + b < b + a; }
int main() {
  n = IN();
  for (int i = 1; i <= n; i++) {
    scanf("%s", ch);
    s[i] = string(ch);
  }
  sort(s + 1, s + n + 1, cmp);
  for (int i = 1; i <= n; i++) printf("%s", s[i].c_str());
}
