#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, len, num, l, mx, ans;
string s, t, q, p;
int nxt[1000005];
void getnext(string t, int clen) {
  nxt[0] = -1;
  int k = -1, j = 0;
  while (j < clen) {
    if (k == -1 || t[k] == t[j])
      nxt[++j] = ++k;
    else
      k = nxt[k];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    l = q.size();
    len = s.size();
    if (l < len) l = len;
    p = q.substr(l - len, l);
    t = s + '*' + p;
    l = t.size();
    getnext(t, l);
    ans = nxt[l];
    q.erase(q.size() - ans, q.size());
    q += s;
  }
  cout << q;
  return 0;
}
