from collections import * N = int(input()) S = [None] * N for i in range(N): S[i] = Counter(input()) def check(a, b): for k, v in S[b].items(): if S[a][k] < v: return 0 return 1 for i in range(N): temp = 0 flag = 1 for j in range(N): if i == j: continue if S[i] == S[j]: flag = 0 break if not flag: continue for k in range(26): S[i][chr(ord("a") + k)] += 1 for j in range(N): if check(i, j): temp += 1 if temp == 1: ans = "" for k, v in S[i].items(): ans += k * v print(ans) exit() S[i][chr(ord("a") + k)] -= 1 print(-1)