#include <bits/stdc++.h>
using namespace std;
int n;
string S[50010];
bool cmp(const string& a, const string& b) {
  return (a + b).compare(b + a) < 0;
}
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    char s[60];
    scanf("%s", s);
    S[i] = string(s);
  }
  sort(S, S + n, cmp);
  for (int i = 0; i < n; ++i) {
    printf("%s", S[i].c_str());
  }
  printf("\n");
  return 0;
}
