#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
int main() {
  ios::sync_with_stdio(false);
  const int m = 1000000409, p = 131;
  int n;
  cin >> n;
  string ans;
  while (n--) {
    string s;
    cin >> s;
    int left = 0, right = 0, common = 0, tmp = 1;
    for (int i = 0; i < int(s.size()); i++) {
      int j = ans.size() - 1 - i;
      if (j < 0) break;
      right = (1LL * p * right + s[i]) % m;
      left = (left + 1LL * ans[j] * tmp % m) % m;
      tmp = 1LL * tmp * p % m;
      if (left == right) common = i + 1;
    }
    for (int i = common; i < int(s.size()); i++) ans.push_back(s[i]);
  }
  cout << ans << endl;
}
