def oi(): return int(input()) def os(): return input().rstrip() def mi(): return list(map(int, input().split())) # import sys # input = sys.stdin.readline # import sys # sys.setrecursionlimit(10**8) # import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') from collections import defaultdict, Counter input_count = 0 N = oi() dicts = defaultdict(int) out = [] for _ in range(N): S = "".join(sorted(list(os()))) dicts[S] += 1 # 包含関係を確認する OK = [] # Aの中にBが含まれていたらTrueを返す def check(A, B): As = Counter(A) Bs = Counter(B) keys = set(list(As.keys()) + list(Bs.keys())) if len(A) < len(B): for k in keys: if k not in Bs and k in As: return False if k in As and k in Bs and As[k] > Bs[k]: return False elif len(A) > len(B): for k in keys: if k in Bs and k not in As: return False if k in As and k in Bs and As[k] < Bs[k]: return False else: if set(list(As.keys())) != set(list(Bs.keys())): return False for k in keys: if As[k] != Bs[k]: return False return True OK_list = [] keys = list(dicts.keys()) for i in range(len(keys)): o1 = keys[i] flg = True for j in range(i+1, len(keys)): o2 = keys[j] if check(o1, o2): flg = False break if flg: OK_list.append(o1) alpha = [chr(ord("a")+i) for i in range(26)] output = "-1" flg = False for o in OK_list: for a in alpha: temp = "".join(sorted(list(o+a))) count = 0 for o1 in dicts.keys(): if check(temp, o1): count += dicts[o1] if count == 1: output = temp flg=True break if flg: break print(output)