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

int main(){
    int n;
    string stmp;
    string s[52];

    while(true){
        cin >> n;
        if(n == 0) break;

        int maxk = 0;
        for(int i=0;i<n;i++){
            cin >> stmp;
            string scode = "";
            scode += stmp[0];
            for(int j=1;j<stmp.length();j++){
                if(stmp[j-1] == 'a' || stmp[j-1] == 'i' || stmp[j-1] == 'u' || stmp[j-1] == 'e' || stmp[j-1] == 'o'){
                    scode += stmp[j];
                }
            }
            s[i] = scode;
            maxk = max(maxk, (int)scode.length());
        }

        for(int k = 1;k<=maxk;k++){
            set<string> stringset;
            for(int i=0;i<n;i++){
                stringset.insert(s[i].substr(0, k));
            }
            if(stringset.size() == n){
                cout << k << "\n";
                break;
            }
            else{
                if(k == maxk){
                    cout << -1 << "\n";
                }
            }
        }

    }

    return 0;
}
