wN = input() S = [raw_input()[::-1] for _ in xrange(N)] ans = '' while len(S) > 0: min_s = 'zzz' min_i = [] for i, s in enumerate(S): if s[-1] < min_s: min_s = s[-1] min_i = [i] elif s[-1] == min_s: min_i.append(i) min_i = min(min_i, key=lambda i:S[i][::-1]) if len(min_i) > 1 else min_i[0] ans += S[min_i][-1] if len(S[min_i]) == 1: S.pop(min_i) else: S[min_i] = S[min_i][:-1] print ans