N = int(input()) S = [tuple(sorted(list(input()))) for _ in range(N)] C = {} for i in range(N): if S[i] not in C: C[S[i]] = [] C[S[i]].append(i) L = {} for s in C: if len(C[s])>1:continue i = C[s][0] if len(S[i]) not in L: L[len(S[i])] = [] L[len(S[i])].append(i) def dist(x,y): cnt = 0 for i in range(len(x)): if x[i]!=y[i]: cnt += 1 return cnt Let = set([chr(i) for i in range(97,123)]) T = "" for l in L: for i in L[l]: A = set() for j in L[l]: if i==j:continue if dist(S[i],S[j])==1: for k in range(l): if S[i][k]!=S[j][k]: A.add(S[j][k]) break if len(A)<26: A = set(A) B = Let-A b = B.pop() T = "".join(list(S[i])+[b]) break if T!="":break if T!="": print(T) else: print(-1)