#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>

using namespace std;

int main()
{
  int N;
  while (cin>>N, N) {

    vector<string> S(N);

    vector<char> list = {'a', 'i', 'u', 'e', 'o'};

    for (int i=0; i<N; i++) {
      cin>>S[i];
    }

    for (int k=1; k<=50; k++) {
      set<string> code;
      bool ok=true;

      for (int i=0; i<N; i++) {
        string tmp;
		 tmp += S[i][0];
		 
        for (int j=0; j<S[i].size(); j++) {
          if (tmp.size() == k) break;

          if (j+1<S[i].size() && find(list.begin(), list.end(), S[i][j]) != list.end()) {
            tmp+=S[i][j+1];
          }
        }

        if (code.count(tmp)) {
          ok=false;
          break;
        } else {
          code.insert(tmp);
         // cerr << tmp << endl;
        }
      }

      if (ok) {
        cout << k << endl;
        goto end;
      }
    }
    cout << -1 << endl;
end:;
  }
}