N = int(input()) S = [input() for _ in range(N)] cnt = [[0]*26 for _ in range(N)] for i in range(len(S)): for j in range(len(S[i])): cnt[i][ord(S[i][j])-ord("a")] += 1 def check(C, A): flag = False for i in range(26): if C[i] != A[i]: if flag: return False elif C[i]+1 == A[i]: flag = True else: return False return flag for i in range(N): A = cnt[i][:] for j in range(26): A[j] += 1 c = 0 for k in range(N): if len(S[i]) == len(S[k]) and check(cnt[k], A): c += 1 if c >= 2: break if c == 1: exit(print(S[i] + chr(j+ord("a")))) A[j] -= 1 print(-1)