#include <bits/stdc++.h>
using namespace std;
int pi(string a, string b) {
  string t = a + "#" + b;
  int n = t.size();
  vector<int> p(n);
  for (int i = 1; i < n; i++) {
    int c = p[i - 1];
    while (c > 0 && t[c] != t[i]) c = p[c - 1];
    if (t[c] == t[i]) p[i] = c + 1;
  }
  return p.back();
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  string ans;
  vector<string> word(n);
  for (int i = 0; i < n; i++) cin >> word[i];
  ans = word[0];
  for (int i = 1; i < n; i++) {
    int s = word[i].size();
    int cut = pi(word[i], ans.substr(max(0, int(ans.size() - s)), s));
    if (cut < s) ans += word[i].substr(cut, s - cut);
  }
  cout << ans;
}
