def find_string(strings): char_count = {} for string in strings: for char in string: char_count[char] = char_count.get(char, 0) + 1 unique_char = None for char, count in char_count.items(): if count == 1: unique_char = char break if unique_char is None: return -1 for string in strings: if unique_char in string: string += 'a' return ''.join(sorted(string)) N = int(input()) strings = [] for _ in range(N): strings.append(input().strip()) result = find_string(strings) print(result)