#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


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

int main(){
    while(1){
    int n;
    cin>>n;
    if(n==0)break;
    vector<string> s(n);
    int k = 0;
    bool f = true;
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<n;i++)s[i] = chan(s[i]);
    for(int i=0;i<n&&f;i++){
	for(int j=i+1;j<n&&f;j++){
	    int cnt = 0;
	    if( s[i] == s[j] ){
		f = false;
		cout<<-1<<endl;
		break;
	    }
	    for(int l = 0;l< min( s[i].size() , s[j].size() );l++){
		if(s[i][l] == s[j][l] )cnt++;
		else break;
	    }
	    k = max( k , cnt);
	}
    }
    if(f)
    cout<<k+1<<endl;
    }
    return 0;
}

