#include <bits/stdc++.h>
using namespace std;
const int base1 = 119, mod1 = 1000000007;
const int base2 = 301, mod2 = 998244353;
const int N = 1e6 + 100005;
int n;
long long b1[N], b2[N];
char s[N];
int lens;
long long h1[N], h2[N];
char t[N];
int lent;
long long q1[N], q2[N];
pair<long long, long long> hashs(int l, int r) {
  return make_pair((h1[r] - h1[l - 1] * b1[r - l + 1] % mod1 + mod1) % mod1,
                   (h2[r] - h2[l - 1] * b2[r - l + 1] % mod2 + mod2) % mod2);
}
pair<long long, long long> hasht(int l, int r) {
  return make_pair((q1[r] - q1[l - 1] * b1[r - l + 1] % mod1 + mod1) % mod1,
                   (q2[r] - q2[l - 1] * b2[r - l + 1] % mod2 + mod2) % mod2);
}
int main() {
  scanf("%d", &n);
  b1[0] = b2[0] = 1;
  for (int i = 1; i <= 1000002; i++)
    b1[i] = b1[i - 1] * base1 % mod1, b2[i] = b2[i - 1] * base2 % mod2;
  while (n--) {
    scanf("%s", t + 1);
    lent = strlen(t + 1);
    for (int i = 1; i <= lent; i++) {
      q1[i] = (q1[i - 1] * base1 + t[i]) % mod1;
      q2[i] = (q2[i - 1] * base2 + t[i]) % mod2;
    }
    int try_len = min(lent, lens);
    for (; try_len; try_len--)
      if (hasht(1, try_len) == hashs(lens - try_len + 1, lens)) break;
    for (int tt = try_len + 1; tt <= lent; tt++) {
      s[++lens] = t[tt];
      h1[lens] = (h1[lens - 1] * base1 + t[tt]) % mod1;
      h2[lens] = (h2[lens - 1] * base2 + t[tt]) % mod2;
    }
  }
  puts(s + 1);
  return 0;
}
