#include <bits/stdc++.h>
using namespace std;
long long extend[2000001];
long long Next[2000001];
void getNext(string t) {
  long long len = t.length();
  Next[0] = len;
  long long a, p;
  a = 1;
  while (a < len && t[a] == t[a - 1]) a++;
  Next[1] = a - 1;
  a = 1;
  for (long long i = 2; i < len; i++) {
    p = a + Next[a] - 1;
    if ((i - 1) + Next[i - a] < p)
      Next[i] = Next[i - a];
    else {
      long long j = (p - i + 1) > 0 ? (p - i + 1) : 0;
      while (i + j < len && t[i + j] == t[j]) j++;
      Next[i] = j;
      a = i;
    }
  }
}
void exkmp(string s, string t) {
  for (int i = 0; i < 2 * t.size(); i++) extend[i] = Next[i] = 0;
  getNext(t);
  long long a, p;
  long long slen = s.length();
  long long tlen = t.length();
  a = p = 0;
  long long len = min(s.length(), t.length());
  while (p < len && t[p] == s[p]) p++;
  extend[0] = p;
  for (long long i = 1; i < slen; i++) {
    p = a + extend[a] - 1;
    if ((i - 1) + Next[i - a] < p)
      extend[i] = Next[i - a];
    else {
      long long j = (p - i + 1) > 0 ? (p - i + 1) : 0;
      while (j < tlen && i + j < slen && s[i + j] == t[j]) j++;
      extend[i] = j;
      a = i;
    }
  }
}
string p[100001], s, t, kk;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) cin >> p[i];
  kk = kk + p[1];
  for (int i = 2; i <= n; i++) {
    int len = kk.length();
    t = p[i];
    int lenb = t.length();
    int st = max(0, len - lenb);
    s = kk.substr(st, min(len, lenb));
    exkmp(s, t);
    int maxs = 0;
    for (int i = 0; i < lenb; i++) {
      if (extend[i] == min(len, lenb) - i) {
        maxs = extend[i];
        break;
      }
    }
    kk += t.substr(maxs, lenb - maxs);
  }
  cout << kk << endl;
  return 0;
}
