import heapq n = int(input()) hp = [] for _ in range(n): si = input() heapq.heappush(hp, si) ans = [] while len(hp) > 0: cur = heapq.heappop(hp) if len(cur) == 1 or len(hp) == 0: ans.append(cur) else: ans.append(cur[0]) heapq.heappush(hp, cur[1:]) print("".join(ans))