import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() S = [S()+'{' for _ in range(N)] S.sort() ANS = [] while True: L = [[] for _ in range(26)] for s in S: L[ord(s[0])-97].append(s) for i in range(26): if L[i]: L[i].sort() ANS.append(L[i][0][0]) new = [] if len(L[i][0]) >= 3: new.append(L[i][0][1:]) for s in L[i][1:]: new.append(s) for j in range(i+1,26): for s in L[j]: new.append(s) S = new break else: break ans = ''.join(ANS) print(ans)