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

int main(){
    int n;
    while(cin >> n, n != 0){
        vector<string> v;
        for(int i=0;i<n;++i){
            string s;
            cin >> s;
            string t = "";
            t.push_back(s[0]);
            for(int j=0;j<s.size()-1;++j){
                if(s[j] == 'a' || s[j] == 'i' || s[j] == 'u' || s[j] == 'e' || s[j] == 'o'){
                    t.push_back(s[j+1]);
                }
            }
            v.push_back(t);
        }

        bool ng = true;
        for(int k=1;k<=50;++k){
            set<string> st;
            for(auto e : v){
                st.insert(e.substr(0, min(k, (int)e.size())));
            }
            if(st.size() == n){
                ng = false;
                cout << k << endl;
                break;
            }
        }

        if(ng)cout << -1 << endl;
    }

    return 0;
}

