N=int(input()) S=[[ord(s)-97 for s in input()] for i in range(N)] C=[[0]*26 for i in range(N)] for i in range(N): for s in S[i]: C[i][s]+=1 for i in range(N): for a in range(26): T=S[i]+[a] cnt=[0]*26 for t in T: cnt[t]+=1 for j in range(N): if i==j: continue if len(S[i])!=len(S[j]): continue if all(C[j][b]<=cnt[b] for b in range(26)): break else: ans="" for a in range(26): ans+=chr(a+97)*cnt[a] print(ans) exit() print(-1)