#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t

string getcode(string s){
    string ret = "";
    
    ret = ret + s[0];
    
    for(int i = 1 ; i < s.size() ; i++ ){
        char c = s[i-1];
        if( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ){
            ret = ret + s[i];
        }
    }
    
    return ret;
}

void solve(){
    int n;
    cin >>n;
    string s[64];
    int max_len = 0;
    
    if(n==0)exit(0);
    
    for(int i = 0 ; i < n ; i++ ){
        string temp;
        cin >> temp;
        s[i] = getcode(temp);
        max_len = max(max_len,(int)s[i].size());
        //cout << s[i] << endl;
    }
    
    for(int len = 1 ; len <= 64 ; len++ ){
        map<string,bool> lut;
        bool flag = true;
        for(int i = 0 ; i <  n && flag ; i++ ){
            string temp;
            
            if( s[i].size() < len ){
                temp = s[i];
            }else{
                temp = s[i].substr(0,len);
            }
            
            if( lut.find(temp) != lut.end() ){
                flag = false;
            }else{
                lut[temp] = true;
            }
        }
        
        if( flag ){
            cout << len << endl;
            return;
        }
    }
    
    cout << -1 << endl;
}

int main(void){
    while(true)solve();
    return 0;
}