/*  -*- coding: utf-8 -*-
 *
 * 2700.cc: Airport Codes
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50;

/* typedef */

/* global variables */

string acs[MAX_N];

/* subroutines */

inline bool is_vowel(char c) {
  return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}

/* main */

int main() {
  for (;;) {
    int n;
    cin >> n;
    if (n == 0) break;

    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;

      acs[i].clear();
      bool vf = true;
      for (int j = 0; j < s.size(); j++) {
	if (vf) acs[i] += s[j];
	vf = is_vowel(s[j]);
      }
    }
    sort(acs, acs + n);
    //for (int i = 0; i < n; i++) puts(acs[i].c_str());

    int maxk = 0;
    for (int i = 1; i < n; i++) {
      string &ac0 = acs[i - 1], &ac1 = acs[i];
      int l0 = ac0.size(), l1 = ac1.size(), l = min(l0, l1);
      int k = 0;
      for (; k < l && ac0[k] == ac1[k]; k++);
      if (k >= l && l0 == l1) {
	maxk = -1;
	break;
      }
      if (maxk < k + 1) maxk = k + 1;
    }

    printf("%d\n", maxk);
  }
  return 0;
}