N = int(input()) L = [[0]*26 for _ in range(N)] cand = [] for i in range(N): s = input() cand.append(s) for si in s: j = ord(si)-ord("a") L[i][j] += 1 for i in range(N): OK = [False] * N OK[i] = True skips = set() for j in range(N): if i==j:continue flag = False NG = [] for k in range(26): if L[j][k] == L[i][k]: continue flag = True if L[j][k] - L[i][k] == 1: NG.append(k) OK[j] = flag if len(NG)==1: skips.add(NG[0]) if all(OK) and len(skips) < 26 : break if not all(OK): print("-1") else: if len(skips)==26: print("-1") else: for x in range(26): if not x in skips: break ans = cand[i] + chr(x+ord("a")) print(ans)