from collections import defaultdict dd=defaultdict(int) n=int(input()) for i in range(n): s=input() for c in range(26): t=''.join(sorted(s+chr(ord('a')+c))) dd[t]+=1 for k,v in dd.items(): if v==1: print(k) break else: print(-1)