from collections import Counter from string import ascii_lowercase cnt = Counter() for _ in range(int(input())): S = input() for c in ascii_lowercase: T = "".join(sorted(S + c)) cnt[T] += 1 for T, n in cnt.items(): if n == 1: print(T) break else: print(-1)