#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e4 + 100;
int n, p[MAXN];
string ss[MAXN];
char s[MAXN][55];
bool comp(int i, int j) { return ss[i] + ss[j] < ss[j] + ss[i]; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
    ss[i] = s[i];
    p[i] = i;
  }
  sort(p, p + n, comp);
  for (int i = 0; i < n; i++) printf("%s", s[p[i]]);
  return 0;
}
