#include <bits/stdc++.h>
using namespace std;
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int Rand(int l, int r) { return uniform_int_distribution<int>(l, r)(rd); }
const int N = (int)1e5 + 9, M = (int)1e6 + 9, base = 311,
          mod = (int)1e9 + Rand(7, 9277) * 2 + 1;
unsigned long long pw1[M] = {1};
long long pw2[M] = {1};
int n;
string s[N];
vector<unsigned long long> hash_1[N];
vector<int> hash_2[N];
void build_hash(int p) {
  hash_1[p].emplace_back(0);
  hash_2[p].emplace_back(0);
  for (int i = 0; i < s[p].size(); ++i) {
    hash_1[p].emplace_back(hash_1[p].back() + pw1[i + 1] * s[p][i]);
    hash_2[p].emplace_back((hash_2[p].back() + pw2[i + 1] * s[p][i]) % mod);
  }
}
bool check(int len, int p) {
  int k = s[0].size() - len + 1;
  return (hash_1[0].back() - hash_1[0][k - 1] == hash_1[p][len] * pw1[k - 1] &&
          (hash_2[0].back() - hash_2[0][k - 1] + mod) % mod ==
              (hash_2[p][len] * pw2[k - 1]) % mod);
}
int getpos(int i) {
  for (int j = min(s[0].size(), s[i].size()); j > 0; --j)
    if (check(j, i)) return j;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  for (int i = 1; i < M; ++i)
    pw1[i] = pw1[i - 1] * base, pw2[i] = (pw2[i - 1] * base) % mod;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    build_hash(i);
  }
  for (int i = 1, p; i < n; ++i) {
    p = getpos(i);
    while (p < s[i].size()) {
      s[0] += s[i][p++];
      hash_1[0].emplace_back(hash_1[0].back() + pw1[s[0].size()] * s[0].back());
      hash_2[0].emplace_back(
          (hash_2[0].back() + pw2[s[0].size()] * s[0].back()) % mod);
    }
  }
  cout << s[0];
}
