from collections import Counter from string import ascii_lowercase import sys def printe(*args, end="\n", **kwargs): print(*args, end=end, file=sys.stderr, **kwargs) def main(): N = int(input()) S = [input() for _ in range(N)] S_ctrs = list(map(Counter, S)) S_sorted = list(map(lambda elm: "".join(sorted(elm)), S)) S_cand = set() S_sorted_ctr = Counter(S_sorted) for sort_elm, elm in zip(S_sorted, S): if S_sorted_ctr[sort_elm] == 1: S_cand.add(elm) if not S_cand: print(-1) return for elm in S_cand: for add_letter in ascii_lowercase: tmp_ctr = Counter(elm) tmp_ctr[add_letter] += 1 for other_elm, other_ctr in zip(S, S_ctrs): tmp_tmp_ctr = tmp_ctr.copy() if other_elm == elm: continue tmp_tmp_ctr.subtract(other_ctr) if all(map(lambda elm: elm >= 0, tmp_tmp_ctr.values())): break else: print(elm + add_letter) return print(-1) if __name__ == "__main__": main()