#include<bits/stdc++.h>
using namespace std;

string makeCode(string &s, int k){
  set<char> vowel = {'a', 'i', 'u', 'e', 'o'};
  string res = s.substr(0, 1);
  for (int i = 0; i < s.length() - 1; i++) {
    if(vowel.find(s[i]) == vowel.end())continue;
    res += s[i + 1];
  }
  return res.substr(0, k);
}

int main(){
  int n;
  while(std::cin >> n, n){
    vector<string> s(n);
    int maxi = 0;
    for (int i = 0; i < n; i++) {
      std::cin >> s[i];
      maxi = max(maxi, (int)s[i].length());
    }
    int k = 0;
    bool f = true;
    while(f and k <= maxi){
      k++;
      f = false;
      set<string> ss;
      for (int i = 0; i < n; i++) {
        string code = makeCode(s[i], k);
        //std::cout << code << std::endl;
        if(ss.find(code) != ss.end())f = true;
        ss.insert(code);
      }
    }
    if(k <= maxi)std::cout << k << std::endl;
    else std::cout << -1 << std::endl;
  }
  return 0;
}