#include <bits/stdc++.h>
using namespace std;
typedef struct node {
  char str[55];
} node;
node ma[50050];
int n;
bool comp(node a, node b) {
  if (a.str[0] != b.str[0]) {
    return a.str[0] < b.str[0];
  } else {
    int la = strlen(a.str), lb = strlen(b.str);
    int i, j, l;
    l = min(la, lb);
    for (i = 0; i < l; i++) {
      if (a.str[i] != b.str[i]) return a.str[i] < b.str[i];
    }
    char a1[110], b1[110];
    for (i = 0; i < la; i++) a1[i] = a.str[i];
    for (i = la; i < la + lb; i++) a1[i] = b.str[i - la];
    a1[la + lb] = '\0';
    for (i = 0; i < lb; i++) b1[i] = b.str[i];
    for (i = lb; i < la + lb; i++) b1[i] = a.str[i - lb];
    b1[la + lb] = '\0';
    int tmp = strcmp(a1, b1);
    if (tmp == 0)
      return 0;
    else if (tmp > 0)
      return 0;
    else
      return 1;
  }
}
int main() {
  int i, j;
  while (~scanf("%d", &n)) {
    for (i = 0; i < n; i++) scanf("%s", ma[i].str);
    sort(ma, ma + n, comp);
    for (i = 0; i < n; i++) {
      int tmp = strlen(ma[i].str);
      for (j = 0; j < tmp; j++) {
        printf("%c", ma[i].str[j]);
      }
    }
    putchar('\n');
  }
  return 0;
}
