N = int(input()) S = [input() for _ in range(N)] ans = '' while S: S.sort() mark = 0 for i in range(1, len(S)): if len(S[i])>=len(S[0]) and S[i][:len(S[0])]==S[0]: mark = i break ans += S[mark][0] S[mark] = S[mark][1:] if S[mark]=='': S = [S[i] for i in range(len(S)) if i!=mark] print(ans)