#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int maxn = 1e5 + 9;
const int inf = 2e9;
const int mod = 10007;
long long c[5] = {257, 263, 269, 271, 277};
long long h[5] = {1000000007, 1000000009, 1000000021, 1000000033, 1000000087};
string op[maxn];
int sol(string &a, string &b, long long B, long long m) {
  int p = a.length(), q = b.length();
  int ans = 0;
  unsigned long long ah = 0, bh = 0, jk = 1;
  for (int i = 1; i <= min(p, q); ++i) {
    ah = (ah + jk * a[p - i] % m) % m;
    bh = (bh * B % m + b[i - 1]) % m;
    jk = jk * B % m;
    if (ah == bh) ans = i;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> op[i];
  string tmp = op[0];
  for (int i = 1; i < n; ++i) {
    int jk = inf;
    for (int j = 0; j < 5; ++j) jk = min(jk, sol(tmp, op[i], c[j], h[j]));
    tmp += op[i].substr(jk);
  }
  cout << tmp;
  return 0;
}
