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 input_count = 0 N = oi() dicts = defaultdict(int) out = [] for _ in range(N): S = "".join(sorted(list(os()))) dicts[S] += 1 alpha = [chr(ord("a")+i) for i in range(26)] output = "-1" flg = False for o in dicts.keys(): for a in alpha: temp = "".join(sorted(list(o+a))) count = 0 for i in range(len(temp)): temp2 = temp[:i] + temp[i+1:] if temp2 in dicts: count += dicts[temp2] if count == 1: output = temp flg=True break if flg: break print(output)