#include <bits/stdc++.h>
using namespace std;
const int maxlongint = 2147483647;
const int P1 = 19260817, P2 = 1000000007, N = 100011, M = 1000011;
long long mi1[M], mi2[M], ni1[M], ni2[M], s1[M], s2[M];
char st[M], Ans[M];
long long powder(int x, int a, const int& P) {
  if (!a) return 1;
  long long tot = powder(x, a >> 1, P);
  tot = (tot * tot) % P;
  if (a & 1) tot = (tot * x) % P;
  return tot;
}
inline long long num(char ch) {
  return ('0' <= ch && ch <= '9')
             ? (ch - '0')
             : (('a' <= ch && ch <= 'z') ? (ch - 'a' + 10) : (ch - 'A' + 36));
}
void pre(int n) {
  long long c = 62, nn1 = powder(c, P1 - 2, P1), nn2 = powder(c, P2 - 2, P2);
  if (nn1 * 62 % P1 != 1 || nn2 * 62 % P2 != 1) printf("Sfsf\n");
  mi1[0] = 1;
  for (int i = 1; i <= n; i++) {
    mi1[i] = (mi1[i - 1] * c) % P1;
    if (mi1[i] < 0)
      while (1) mi1[-154151564];
  }
  mi2[0] = 1;
  for (int i = 1; i <= n; i++) {
    mi2[i] = (mi2[i - 1] * c) % P2;
    if (mi2[i] < 0)
      while (1) mi2[-134564522];
  }
  ni1[0] = 1;
  for (int i = 1; i <= n; i++) ni1[i] = ni1[i - 1] * nn1 % P1;
  ni2[0] = 1;
  for (int i = 1; i <= n; i++) ni2[i] = ni2[i - 1] * nn2 % P2;
}
int main() {
  pre(1000000);
  int n;
  scanf("%d", &n);
  int totlen = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", st + 1);
    int l = strlen(st + 1);
    int pos = 0;
    long long c = 62;
    long long sh1 = 0, sh2 = 0;
    for (int j = 1; j <= l && j <= totlen; j++) {
      sh1 = (sh1 * c + num(st[j])) % P1;
      sh2 = (sh2 * c + num(st[j])) % P2;
      if (sh1 < 0 || sh2 < 0)
        while (1) putchar('\n');
      if ((s1[totlen] - s1[totlen - j] * mi1[j] % P1 + P1) % P1 == sh1 &&
          (s2[totlen] - s2[totlen - j] * mi2[j] % P2 + P2) % P2 == sh2)
        pos = j;
    }
    for (int j = pos + 1; j <= l; j++) {
      Ans[++totlen] = st[j];
      s1[totlen] = (s1[totlen - 1] * c + num(Ans[totlen])) % P1;
      s2[totlen] = (s2[totlen - 1] * c + num(Ans[totlen])) % P2;
      if (s1[totlen] * c < 0 || s2[totlen] * c < 0)
        while (1) putchar('\n');
    }
  }
  for (int i = 1; i <= totlen; i++) putchar(Ans[i]);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
