#include <bits/stdc++.h>
using namespace std;
long long rr[] = {0, 1, 1, 1, 0, -1, -1, -1};
long long cc[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long mod = 1e9 + 7;
const long long N = 300050;
string merge(string a, string b) {
  string s = b + "&" + a;
  long long n = s.size();
  vector<long long> vec(n);
  vec[0] = 0;
  for (long long i = 1; i < n; i++) {
    long long j = vec[i - 1];
    while (j > 0 && s[i] != s[j]) j = vec[j - 1];
    if (s[i] == s[j]) j++;
    vec[i] = j;
  }
  string temp;
  for (long long i = vec[n - 1]; i < (long long)b.size(); i++) {
    temp.push_back(b[i]);
  }
  return temp;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long test = 1;
  while (test--) {
    long long n;
    cin >> n;
    string s[n];
    for (long long i = 0; i < n; i++) {
      cin >> s[i];
    }
    string ans = s[0];
    for (long long i = 1; i < n; i++) {
      string temp, tmp;
      if ((long long)ans.size() < s[i].size()) {
        tmp = ans;
      } else {
        tmp = ans.substr((long long)ans.size() - (long long)s[i].size(),
                         (long long)s[i].size());
      }
      temp = merge(tmp, s[i]);
      ans += temp;
    }
    cout << ans << '\n';
  }
  return 0;
}
