def shin(chara)
	if chara != 'a' && chara != 'i' && chara != 'u' && chara != 'e' && chara != 'o' 
		return true
	end
	return false
end

N = gets.to_i
while N > 0
	memory = []
	res = []
	maxsize = 0
	for i in 0..N-1
		res << ""
		tmp = gets
		memory << tmp
		#
		bch = 'a'
		cnt = 0
		for j in 0..memory[i].size-1
			tmp2 = memory[i][cnt]
			memory[i][cnt] = '!' if shin(bch)
			bch = tmp2
			cnt = cnt + 1
		end
		memory[i] = memory[i].delete('!').delete("\n")
		#p memory[i]
		#
		maxsize = memory[i].size if memory[i].size > maxsize
	end
	#p maxsize
	count = 0
	while res.size != res.uniq.size || count == 0
		if count >= maxsize
			count = 0
			break
		end
		for i in 0..N-1
			res[i] << memory[i][count] if count < memory[i].size
			#p res[i]
		end
		count += 1
	end
	if count > 1
		p count
	elsif count == 1
		p 1
	else
		p -1
	end
	N = gets.to_i
end