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

using namespace std;

string process(string s) {
  string ret = "";
  ret += s[0];
  int idx = 0;
  bool flag = false;
  while(idx < s.size()) {
    char c = s[idx];
    if (flag) {
      ret += c;
      flag = false;
    }
    if (c == 'a'
        || c == 'i'
        || c == 'u'
        || c == 'e'
        || c == 'o') {
      flag = true;
    }

    idx++;
  }
  return ret;
}

int main() {
  int n;
  while (cin >> n, n) {
    vector<string> S;
    while(n--) {
      string s; cin >> s;
      // cerr << s << "=>" << process(s) << endl;
      S.push_back(process(s));
    }
    sort(S.begin(), S.end());
    int ans = -1;
    for(int k = 1; k <= 50; k++) {
      set<string> tmp;
      for(string s:S) tmp.insert(s.substr(0, k));
      if(tmp.size() == S.size()) {
        ans = k;
        break;
      }
    }
    cout << ans << endl;
  }

  return 0;
}