#include <bits/stdc++.h>
using namespace std;
const int MX = 1000000;
const long long inf = 1e18;
long long pw[MX], pw1[MX], h[MX], h1[MX], inv[MX], inv1[MX];
long long bigmod(int a, int b, long long mod) {
  if (!b) return 1;
  if (b & 1)
    return (a * bigmod(a, b - 1, mod)) % mod;
  else {
    long long r = bigmod(a, b / 2, mod);
    return (r * r) % mod;
  }
}
long long modInverse(int a, long long mod) { return bigmod(a, mod - 2, mod); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k, j;
  long long mod = 1e9 + 7, mod1 = 999999937;
  long long base = 29, base1 = 17;
  string s;
  pw[0] = pw1[0] = 1;
  for (int i = 1; i < MX; i++) {
    pw[i] = (pw[i - 1] * base) % mod;
    pw1[i] = (pw1[i - 1] * base1) % mod1;
  }
  long long INV = modInverse(base, mod);
  long long INV1 = modInverse(base1, mod1);
  inv[0] = inv1[0] = 1;
  for (int i = 1; i < MX; i++) {
    inv[i] = (inv[i - 1] * INV) % mod;
    inv1[i] = (inv1[i - 1] * INV1) % mod1;
  }
  cin >> n;
  s = "";
  j = -1;
  while (n--) {
    string s1;
    cin >> s1;
    int lo = 0;
    long long H = 0, H1 = 0;
    for (int i = 0; i < s1.size(); i++) {
      if (i >= s.size()) break;
      H = (H + s1[i] * pw[i]) % mod;
      H1 = (H1 + s1[i] * pw1[i]) % mod1;
      long long hh, hh1;
      if (j - i - 1 >= 0) {
        hh = (h[j] - h[j - i - 1] + mod) % mod;
        hh1 = (h1[j] - h1[j - i - 1] + mod1) % mod1;
        hh = (hh * inv[j - i]) % mod;
        hh1 = (hh1 * inv1[j - i]) % mod1;
      } else {
        hh = h[j];
        hh1 = h1[j];
      }
      if (H == hh && H1 == hh1) lo = i + 1;
    }
    for (int i = lo; i < s1.size(); i++) {
      if (j == -1) {
        s += s1[i];
        ++j;
        h[j] = h1[j] = s1[i];
        continue;
      }
      s += s1[i];
      ++j;
      h[j] = (h[j - 1] + s1[i] * pw[j]) % mod;
      h1[j] = (h1[j - 1] + s1[i] * pw1[j]) % mod1;
    }
  }
  cout << s << endl;
  return 0;
}
