import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline n = int(input()) se = [set() for i in range(n)] for i in range(n): check = [0 for j in range(26)] s = input().rstrip() for j in s: check[ord(j) - ord('a')] += 1 for j in range(26): check[j] += 1 se[i].add(tuple(check)) check[j] -= 1 for i in range(n): for j in se[i]: cnt = 0 for k in range(n): if k == i: continue if j in se[k]: cnt += 1 if cnt == 0: for k in range(26): for l in range(j[k]): print(chr(ord('a') + k),end='') print() exit() print(-1)