#include <bits/stdc++.h>
using namespace std;
const int N = 10000002;
int nxt[N];
char S[N], T[N], str1[N], str2[N];
int slen, tlen;
void getNext() {
  int j, k;
  j = 0;
  k = -1;
  nxt[0] = -1;
  while (j < tlen)
    if (k == -1 || T[j] == T[k]) {
      nxt[++j] = ++k;
      if (T[j] != T[k]) nxt[j] = k;
    } else
      k = nxt[k];
}
int KMP_Index() {
  int i = max(slen - tlen, 0), j = 0;
  getNext();
  while (i < slen && j < tlen) {
    if (j == -1 || S[i] == T[j]) {
      i++;
      j++;
    } else
      j = nxt[j];
  }
  return j;
  if (j == tlen)
    return i - tlen;
  else
    return -1;
}
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", S);
  slen = strlen(S);
  for (int i = 1; i < n; i++) {
    scanf("%s", T);
    tlen = strlen(T);
    int pos = KMP_Index();
    for (int j = pos; j < tlen; j++) {
      S[slen] = T[j];
      slen++;
    }
  }
  printf("%s", S);
  return 0;
}
