#include <bits/stdc++.h>
using namespace std;
int n, t;
long long base = 103, h[1000005], p[1000005], inv[1000005], mod = 1e9 + 21;
string s[100005], ans;
long long pwr(long long a, long long p) {
  if (!p) return 1;
  long long t = pwr(a, p / 2);
  t = (t * t) % mod;
  if (p % 2)
    return (t * a) % mod;
  else
    return t;
}
long long val(char c) {
  if (c >= 'a' && c <= 'z')
    return c - 'a' + 1;
  else if (c >= 'A' && c <= 'Z')
    return c - 'A' + 'z' - 'a' + 2;
  else
    return c - '0' + 'Z' - 'A' + 'z' - 'a' + 3;
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  p[0] = inv[0] = 1;
  p[1] = base;
  inv[1] = pwr(base, mod - 2);
  for (int i = 1; i <= 1000000; i++)
    p[i] = (p[i - 1] * p[1]) % mod, inv[i] = (inv[i - 1] * inv[1]) % mod;
  for (int i = 1; i <= n; i++) {
    int mx = -1;
    long long hsh = 0;
    for (int j = 0; j < min((int)s[i].length(), t); j++) {
      hsh += val(s[i][j]) * p[j];
      hsh %= mod;
      if (hsh == (h[t] - h[t - j - 1] + mod) * inv[t - j] % mod) mx = j;
    }
    for (int j = mx + 1; j < s[i].length(); j++) {
      t++;
      ans += s[i][j];
      h[t] = (h[t - 1] + val(s[i][j]) * p[t]) % mod;
    }
  }
  cout << ans;
}
