#include <bits/stdc++.h>
using namespace std;
int Gcd(int a, int b) {
  if (b == 0) return a;
  return Gcd(b, a % b);
}
int Lcm(int a, int b) { return a / Gcd(a, b) * b; }
template <class T>
void read(T &x) {
  static char ch;
  static bool neg;
  for (ch = neg = 0; ch < '0' || '9' < ch; neg |= ch == '-', ch = getchar())
    ;
  for (x = 0; '0' <= ch && ch <= '9'; (x *= 10) += ch - '0', ch = getchar())
    ;
  x = neg ? -x : x;
}
const int maxn = 1e6 + 10;
const unsigned long long mod1 = 19260817;
const unsigned long long mod2 = 19660813;
const unsigned long long base1 = 163;
const unsigned long long base2 = 131;
char s[maxn], tmp[maxn];
unsigned long long ha1[maxn], ha2[maxn], fac1[maxn], ha11[maxn], ha22[maxn],
    fac2[maxn];
bool check1(int i, int len1) {
  if (ha1[len1] == (ha2[i] * fac1[len1 - i] + ha1[len1 - i]) % mod1) {
    return true;
  }
  return false;
}
bool check2(int i, int len1) {
  if (ha11[len1] == (ha22[i] * fac2[len1 - i] + ha11[len1 - i]) % mod2) {
    return true;
  }
  return false;
}
int main() {
  fac1[0] = 1;
  fac2[0] = 1;
  for (int i = 1; i < maxn; i++) {
    fac1[i] = fac1[i - 1] * base1 % mod1;
    fac2[i] = fac2[i - 1] * base2 % mod2;
  }
  int n, len1 = 0;
  read(n);
  scanf("%s", s + 1);
  len1 = strlen(s + 1);
  for (int i = 1; i <= len1; i++) {
    ha1[i] = (ha1[i - 1] + fac1[i] * s[i]) % mod1;
    ha11[i] = (ha11[i - 1] + fac2[i] * s[i]) % mod2;
  }
  for (int i = 1; i < n; i++) {
    scanf("%s", tmp + 1);
    int len2 = strlen(tmp + 1);
    for (int i = 1; i <= len2; i++) {
      ha2[i] = (ha2[i - 1] + fac1[i] * tmp[i]) % mod1;
      ha22[i] = (ha22[i - 1] + fac2[i] * tmp[i]) % mod2;
    }
    int mx = min(len1, len2), tag = 1;
    for (int i = mx; i >= 1; i--) {
      if (check1(i, len1) && check2(i, len1)) {
        len1 = len1 - i;
        for (int j = 1; j <= len2; j++) {
          ++len1;
          s[len1] = tmp[j];
          ha1[len1] = (ha1[len1 - 1] + fac1[len1] * tmp[j]) % mod1;
          ha11[len1] = (ha11[len1 - 1] + fac2[len1] * tmp[j]) % mod2;
        }
        tag = 0;
        break;
      }
    }
    if (tag) {
      for (int j = 1; j <= len2; j++) {
        ++len1;
        s[len1] = tmp[j];
        ha1[len1] = (ha1[len1 - 1] + fac1[len1] * tmp[j]) % mod1;
        ha11[len1] = (ha11[len1 - 1] + fac2[len1] * tmp[j]) % mod2;
      }
    }
  }
  for (int i = 1; i <= len1; i++) {
    putchar(s[i]);
  }
  putchar('\n');
  return 0;
}
