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