#include <bits/stdc++.h>
using namespace std;
int cpf(string s) {
  vector<int> p(s.size(), 0);
  int k = 0;
  for (int i = 1; i < s.size(); ++i) {
    while ((k > 0) && (s[k] != s[i])) k = p[k - 1];
    if (s[k] == s[i]) ++k;
    p[i] = k;
  }
  return p[s.size() - 1];
}
int main() {
  int n;
  cin >> n;
  string cur, ans, prev;
  cin >> ans;
  prev = ans;
  for (int i = 1; i < n; ++i) {
    cin >> cur;
    string arg = cur + "#";
    for (int j = max((int)ans.size() - (int)cur.size(), 0); j < ans.size();
         ++j) {
      arg += ans[j];
    }
    int d = cpf(arg);
    for (int j = d; j < cur.size(); ++j) {
      ans += cur[j];
    }
    prev = cur;
  }
  cout << ans << '\n';
}
