n = int(input()) words = [] for i in range(n): words.append(input().strip()) words = [w+'z'*50 for w in words] ans = '' while len(words) > 0: words.sort() ans += words[0][0] if len(words[0]) == 51: words.pop(0) else: words[0] = words[0][1:] print(ans)