import heapq N = input() S = [] for i in xrange(N): heapq.heappush(S, raw_input()) ans = '' while len(S) > 0: s = heapq.heappop(S) ans += s[0] if len(s) > 1: heapq.heappush(S, s[1:]) print ans