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 (fun a b -> List.length a - List.length b) (read 0 []) in
  if dup_p l then (-1)
  else
    let rec duduwa k = function
      | ([], _) -> k
      | (_, []) -> k
      | (x::xs, y::ys) when x <> y -> k
      | (_::xs, _::ys) -> duduwa (k + 1) (xs, ys)
    and doit acc = function
      | [] -> acc + 1
      | [x] -> acc + 1
      | x :: y :: z -> doit (max acc (duduwa 0 (x, y))) z
    in
    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 ()