while n = STDIN.gets
  if n == "0\n" then break end
  n = n.chomp.to_i
  airport_codes=[]
  max_length=0
  n.times do 
    airport_name = STDIN.gets.chomp
    airport_code=""
    airport_name.chars.each_with_index do |c, i|
      if i == 0 or airport_name[i-1] == 'a' or airport_name[i-1] == 'i' or airport_name[i-1] == 'u' or airport_name[i-1] == 'e' or airport_name[i-1] == 'o' then
        airport_code += c 
      end 
    end
    airport_codes.push(airport_code)
    if max_length < airport_code.length then
      max_length = airport_code.length
    end
  end
  airport_codes_substring=[]
  k=-1
  (0...max_length).each do |i|
    airport_codes_substring =  airport_codes.map { |code| code[0..i] }
    has_duplicate = airport_codes_substring.find { |code| airport_codes_substring.count(code) > 1 }
    if has_duplicate == nil then 
      k = i+1
      break 
    end 
  end
  puts k
end