from functools import cache voyelles = ["A", "E", "I", "O", "U", "Y"] N = int(input()) words = [input()[:3] for _ in range(N)] @cache def find_consonant(w_index=0, previous=0): if w_index == len(words): return 0 word = words[w_index] valid = [] count = previous for i, w in enumerate(word): if w not in voyelles: count += 1 else: count = 0 # print(i, word[:i+1], count) if count != 3: val = find_consonant(w_index=w_index+1, previous=count) if val == "*": continue valid.append(val+i+1) else: break if valid == []: return "*" return min(valid) print(find_consonant())