#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int mod = 1e9 + 7;
const double eps = 1e-6;
const int N = 1e6 + 7;
const int mod1 = 19260817;
const int mod2 = 19491001;
int b1, p1[N], b2, p2[N];
int hash1[N], hash2[N];
char res[N], s[N];
void init() {
  srand(time(0));
  b1 = rand() % 131;
  b2 = rand() % 13331;
  p1[0] = p2[0] = 1;
  for (int i = 1; i <= N - 1; i++) {
    p1[i] = 1ll * p1[i - 1] * b1 % mod1;
    p2[i] = 1ll * p2[i - 1] * b2 % mod2;
  }
}
int main() {
  init();
  int n;
  scanf("%d", &n);
  int resl = 0;
  for (int i = 0; i <= n - 1; i++) {
    scanf("%s", s + 1);
    int sl = strlen(s + 1);
    int h1 = 0, h2 = 0, len = 0;
    for (int j = 1; j <= min(sl, resl); j++) {
      h1 = (1ll * h1 * b1 % mod1 + s[j]) % mod1;
      h2 = (1ll * h2 * b2 % mod2 + s[j]) % mod2;
      int t1 = (1ll * hash1[resl - j] * p1[j] + h1) % mod1;
      int t2 = (1ll * hash2[resl - j] * p2[j] + h2) % mod2;
      if (hash1[resl] == t1 && hash2[resl] == t2) len = j;
    }
    for (int j = len + 1; j <= sl; j++) {
      res[++resl] = s[j];
      hash1[resl] = (1ll * hash1[resl - 1] * b1 + s[j]) % mod1;
      hash2[resl] = (1ll * hash2[resl - 1] * b2 + s[j]) % mod2;
    }
  }
  printf("%s", res + 1);
  return 0;
}
