#include <bits/stdc++.h>
using namespace std;
const int MN = 1e6 + 10;
int nxt[MN];
char c1[MN], c2[MN];
int getn(int sr, int n, int m) {
  nxt[1] = 0;
  for (int i = 1, j = 0; i < m; ++i) {
    while (j > 0 && c2[j + 1] != c2[i + 1]) j = nxt[j];
    if (c2[j + 1] == c2[i + 1]) ++j;
    nxt[i + 1] = j;
  }
  for (int i = sr, j = 0; i < n; ++i) {
    while (j > 0 && c2[j + 1] != c1[i + 1]) j = nxt[j];
    if (c2[j + 1] == c1[i + 1]) ++j;
    if (i + 1 == n) return j + 1;
  }
}
int main() {
  int n;
  scanf("%d%s", &n, c1 + 1);
  int len = strlen(c1 + 1);
  for (int i = 1; i < n; ++i) {
    scanf("%s", c2 + 1);
    int tmp = strlen(c2 + 1);
    int j = getn(max(len - tmp, 0), len, tmp);
    while (j <= tmp) c1[++len] = c2[j++];
  }
  c1[len + 1] = '\0';
  printf("%s\n", c1 + 1);
  return 0;
}
