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

int main(){
	int n;
	while(cin >> n and n!=0){
		vector<string> s(n);
		for(int i=0;i<n;i++)
			cin >> s[i];

		vector<string> outp(n);
		int mxout=0;
		for(int i=0;i<n;i++){
			outp[i] = "";
			outp[i] += s[i][0];
			for(int j=0;j<s[i].size()-1;j++){
				if(s[i][j]=='a' || s[i][j]=='i' || s[i][j]=='u' || s[i][j]=='e' || s[i][j]=='o' ){
					outp[i] += s[i][j+1];
				}
			}
			if(outp[i].size()>mxout)
				mxout=outp[i].size();
		}

		int ans=-1;
		for(int i=0;i<mxout;i++)
		{
			set<string> st;
			for(int j=0;j<outp.size();j++)
				st.insert(outp[j].substr(0,i+1));
			if(st.size()<outp.size())
				continue;
			else
			{
				ans=i+1;
				break;
			}

		}
		cout << ans << endl;


	}
}

