#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  vector<string> second(n);
  for (long long i = 0; i < n; i++) cin >> second[i];
  string ans = second[0];
  long long p1 = 67, p2 = 73;
  for (long long i = 1; i < n; i++) {
    long long h1 = 0, h2 = 0;
    vector<long long> nh1, nh2, ansh1, ansh2;
    for (long long j = 0; j < second[i].size(); j++) {
      h1 *= p1;
      h2 *= p2;
      h1 = (h1 + second[i][j]) % 1000000007;
      h2 = (h2 + second[i][j]) % 1000000007;
      nh1.push_back(h1);
      nh2.push_back(h2);
    }
    h1 = 0;
    h2 = 0;
    long long b1 = 1, b2 = 1;
    long long len = ans.size();
    for (long long j = 0; j < len && j < second[i].size(); j++) {
      h1 = h1 + (ans[len - 1 - j] * b1) % 1000000007;
      h2 = h2 + (ans[len - 1 - j] * b2) % 1000000007;
      h1 %= 1000000007;
      h2 %= 1000000007;
      ansh1.push_back(h1);
      ansh2.push_back(h2);
      b1 *= p1;
      b2 *= p2;
      b1 %= 1000000007;
      b2 %= 1000000007;
    }
    len = ansh1.size();
    long long brk = 0;
    for (long long j = len - 1; j >= 0; j--) {
      if (ansh1[j] == nh1[j] && ansh2[j] == nh2[j]) {
        brk = j + 1;
        break;
      }
    }
    for (long long j = brk; j < second[i].size(); j++) {
      ans += second[i][j];
    }
  }
  cout << ans;
}
