#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long P = 127;
const long long mod = 1e9 + 7;
string s, ans;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    ans = "\0";
    while (n--) {
      cin >> s;
      int ls = s.size(), la = ans.size();
      int len = min(la, ls), pos = 0;
      long long hs = 0, ha = 0, p = 1;
      for (int i = 0; i < len; i++) {
        ha = ((ans[la - 1 - i] * p % mod) + ha) % mod;
        hs = ((hs * P % mod) + s[i]) % mod;
        if (ha == hs) pos = i + 1;
        p = p * P % mod;
      }
      ans += s.substr(pos);
    }
    cout << ans << "\n";
  }
  return 0;
}
