#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int nextt[N];
void get_next(string s) {
  nextt[1] = 0;
  int len = s.length();
  for (int i = 2, j = 0; i <= len; i++) {
    while (j > 0 && s[j] != s[i - 1]) j = nextt[j];
    if (s[j] == s[i - 1]) j++;
    nextt[i] = j;
  }
}
int f(string b, string a) {
  int l2 = b.length();
  int l1 = a.length();
  int j = 0;
  for (int i = 1; i <= l2; i++) {
    while (j > 0 && (j == l1 || b[i - 1] != a[j])) j = nextt[j];
    if (b[i - 1] == a[j]) j++;
  }
  return j;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string ans;
  cin >> ans;
  for (int i = 2; i <= n; i++) {
    string now;
    cin >> now;
    get_next(now);
    int le = now.length();
    int len = ans.length();
    int pos = f(ans.substr(max(0, len - le), le), now);
    ans += now.substr(pos);
  }
  cout << ans << endl;
}
