#include <bits/stdc++.h>
using namespace std;
const long long q = 239017;
const long long mod = 1e9 + 7;
const long long mod2 = 1e9 + 13;
const long long MAXN = 1e5 + 10;
const long long MAXM = 800;
const long long L = 26;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
pair<long long, long long> p[MAXN * 100];
vector<pair<long long, long long> > h[MAXN];
string v[MAXN];
void prec() {
  p[0] = {1, 1};
  for (long long i = 1; i < MAXN * 100; ++i)
    p[i] = {(p[i - 1].first * q) % mod, (p[i - 1].second * q) % mod2};
}
void calc(long long id) {
  h[id].resize((long long)v[id].size());
  if (!id) h[id].resize(1e6 + 10);
  h[id][0] = {v[id][0], v[id][0]};
  for (long long i = 1; i < (long long)v[id].size(); ++i)
    h[id][i] = {((h[id][i - 1].first * q) % mod + v[id][i]) % mod,
                ((h[id][i - 1].second * q) % mod2 + v[id][i]) % mod2};
}
pair<long long, long long> get(long long l, long long r, long long id) {
  pair<long long, long long> pref;
  if (l) pref = h[id][l - 1];
  return {
      (h[id][r].first - (p[r - l + 1].first * pref.first) % mod + mod) % mod,
      (h[id][r].second - (p[r - l + 1].second * pref.second) % mod2 + mod2) %
          mod2};
}
bool check(long long b, long long sz) {
  long long a = 0;
  long long l1 = (long long)v[a].size() - sz, r1 = (long long)v[a].size() - 1;
  long long l2 = 0, r2 = sz - 1;
  return get(l1, r1, a) == get(l2, r2, b);
}
void $main() {
  prec();
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
    calc(i);
  }
  for (long long i = 1; i < n; ++i) {
    long long tl = 1, tr = min((long long)v[0].size(), (long long)v[i].size()),
              meg = 0;
    for (long long mid = tl; mid <= tr; ++mid)
      if (check(i, mid)) meg = mid;
    for (long long j = meg; j < (long long)v[i].size(); ++j) {
      v[0] += v[i][j];
      h[0][(long long)v[0].size() - 1] = {
          ((h[0][(long long)v[0].size() - 2].first * q) % mod + v[i][j]) % mod,
          ((h[0][(long long)v[0].size() - 2].second * q) % mod2 + v[i][j]) %
              mod2};
    }
  }
  cout << v[0];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  $main();
  return 0;
}
