#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i=(a); i<(n); i++)

#define MAX_K 55
#define ISVOWEL(c) c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'

string get_code(string s, int k) {
    string ret = s.substr(0, 1);
    REP(i, 1, s.size()) {
        if(ISVOWEL(s[i-1])) ret.push_back(s[i]);
    }
    return ret.substr(0, k);
}

int main() {
	int n;
	set<string> codes[MAX_K];
	while(cin >> n, n) {
	    rep(k, MAX_K) codes[k].clear();
	    rep(_, n) {
	        string s;
	        cin >> s;
	        REP(k, 1, MAX_K) codes[k].insert(get_code(s, k));
	    }
	    int ans = -1;
	    REP(k, 1, MAX_K) {
	        // for(string s : codes[k]) cout << s << ", " ;
	        // cout << endl;
	        if(codes[k].size() == n) {
	            ans = k;
	            break;
	        }
	    }
	    cout << ans << endl;
	}
}

