import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline n = int(input()) se = [set() for i in range(n)] a = [] for i in range(n): check = 0 s = input().rstrip() a.append(s) for j in s: check += pow(12,ord(j) - ord('a')) for j in range(26): check += pow(12,j) se[i].add(check) check -= pow(12,j) for i in range(n): for j in se[i]: cnt = 0 for k in range(n): if k == i: continue if len(a[i]) != len(a[k]): continue if j in se[k]: cnt += 1 if cnt == 0: for k in range(26): for l in range((j % pow(12,k+1)) // pow(12,k)): print(chr(ord('a') + k),end='') print() exit() print(-1)