object Main {
    def mk(l: Iterator[String]) = l.map(s => (s.head + s.zip(s.tail).filter(p => "aiueo".contains(p._1)).map(_._2).mkString))

    def main(args: Array[String]) = {
        val in = io.Source.stdin.getLines
        for (n <- in if n != "0") {
            val l = mk(in.take(n.toInt)).toList
            (1 to 50).find(d => {val t = l.map(_.take(d)); t.size == t.distinct.size}) match {
                case Some(x) => println(x)
                case None => println(-1)
            }
        }
    }
}