#!/usr/bin/ruby
def vowel?(char)
  "aeiuo".split("").include? char
end

def makeCodes(airport, k)
  string = ''
  vowel = false

  airport.split("").each_with_index do |ch, index|
    # validation
    if k < 1
      break
    end

    if airport.length <= index
      break
    end

    # add code a char
    if index == 0
      string << ch

      k -= 1
      if vowel? ch
        vowel = true
      end
      next
    end

    if vowel == true
      string << ch

      k -= 1
    end

    # update vowel flag
    if vowel? ch
      vowel = true
    else
      vowel = false
    end

  end
  string
end


while (n = STDIN.gets.chomp.to_i) != 0
  airports = []
  n.times do
    airports << STDIN.gets.chomp
  end

  funiq = true
  (1..airports.map{|x| x.length}.max).each do |k|
    airportCodes = Hash.new
    funiq = true

    airports.each do |airport|
      codes = makeCodes(airport, k)
      if airportCodes.has_key? codes
        funiq = false
        break
      else
        airportCodes[codes] = 1
      end
    end

    if funiq == true
      puts k
      break
    end
  end

  if funiq == false
    puts -1
  end
end