#include<iostream>
#include<map>
using namespace std;
int n;
string s[50];
string get()
{
	string s;cin>>s;
	string t="";t+=s[0];
	for(int i=0;i+1<s.size();i++)if(s[i]=='a'||s[i]=='i'||s[i]=='u'||s[i]=='e'||s[i]=='o')t+=s[i+1];
	return t;
}
int main()
{
	while(cin>>n,n)
	{
		int ml=0;
		for(int i=0;i<n;i++)
		{
			s[i]=get();
			ml=ml<s[i].size()?s[i].size():ml;
		}
		int k;
		for(k=1;k<=ml;k++)
		{
			bool f=1;
			map<string,int>M;
			for(int i=0;i<n;i++)f&=!M[s[i].substr(0,k)]++;
			if(f)break;
		}
		cout<<(k<=ml?k:-1)<<endl;
	}
}

