#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 1e6 + 100;
const int mod = 988888853;
const int base = 233333;
string s, ans;
int main() {
  int n;
  scanf("%d", &n);
  cin >> ans;
  for (int i = 2; i <= n; i++) {
    cin >> s;
    unsigned long long hash1 = 0, hash2 = 0, temp = 1;
    int mark = 0;
    for (int len = 1; len <= min(ans.size(), s.size()); len++) {
      hash1 = (hash1 * base + ans[ans.size() - len] + 100) % mod;
      hash2 = ((s[len - 1] + 100) * temp + hash2) % mod;
      temp = temp * base % mod;
      if (hash1 == hash2) mark = len;
    }
    ans += s.substr(mark);
  }
  cout << ans << endl;
  return 0;
}
