let encode s =
  let n = String.length s in
  let rec doit i acc =
    if i = n - 1 then List.rev acc
    else if String.contains "aeiou" s.[i] then doit (i + 1) (s.[i+1] :: acc)
    else doit (i + 1) acc
  in
  doit 0 [s.[0]]

let rec dup_p = function
  | [] -> false
  | hd :: tl when List.mem hd tl -> true
  | _ :: tl -> dup_p tl

let solve n =
  let rec read i acc =
    if i = n then List.rev acc
    else read (i + 1) (encode (read_line ()) :: acc)
  in
  let l = List.sort compare (read 0 []) in
  if dup_p l then (-1)
  else
    let rec duduwa k = function
      | ([], _) -> k
      | (_, []) -> k
      | (x::_, y::_) when x <> y -> k
      | (_::xs, _::ys) -> duduwa (k + 1) (xs, ys)
    and doit k = function
      | [] -> k
      | [_] -> k
      | x :: (y :: _ as tl) -> doit (max k (duduwa 0 (x, y))) tl
    in
    1 + doit 0 l

let () =
  let rec doit () =
    let n = read_int () in
    if n <> 0 then (Printf.printf "%d\n" (solve n); doit ())
  in
  doit ()