#include <bits/stdc++.h>
                            #include<iostream>
                            #include<cstdio>
                            #include<vector>
                            #include<queue>
                            #include<map>
                            #include<cstring>
                            #include<string>
                            #include <math.h>
                            #include<algorithm>
                        //    #include <boost/multiprecision/cpp_int.hpp>
                            #include<functional>
                 //    #define int long long
                            #define inf  1000000007
                            #define pa pair<int,int>
                            #define ll long long
                            #define pal pair<double,pa>
                            #define ppa pair<pa,int>
                            #define ppap pair<int,pa>
                            #define ssa pair<string,int>
                            #define  mp make_pair
                            #define  pb push_back
                            #define EPS (1e-10)
                            #define equals(a,b) (fabs((a)-(b))<EPS)
                     
                            using namespace std;
                     //priority_queue<int, vector<int>, greater<int> > que;
                            class Point{
                            	public:
                            	double x,y;
                            	Point(double x=0,double y=0):x(x),y(y) {}
                            	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
                            	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
                            	Point operator * (double a) {return Point(x*a,y*a);}
                            	Point operator / (double a) {return Point(x/a,y/a);}
                            	double absv() {return sqrt(norm());}
                            	double norm() {return x*x+y*y;}
                            	bool operator < (const Point &p) const{
                            		return x != p.x ? x<p.x: y<p.y;
                            	}
                            	bool operator == (const Point &p) const{
                            		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
                            	}
                            };
                            typedef Point Vector;
                     
                            struct Segment{
                            Point p1,p2;
                            };
                     
                        double hen(Vector a){
                        if(fabs(a.x)<EPS && a.y>0) return acos(0);
                        else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
                        else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
                        else if(fabs(a.y)<EPS && a.x>0) return 0.0;
                        else if(a.y>0) return acos(a.x/a.absv());
                        else return 2*acos(0)+acos(-a.x/a.absv());
                     
                        }
                     
                string itos( int i ) {
                ostringstream s ;
                s << i ;
                return s.str() ;
                }
                 
                int gcd(int v,int b){
                	if(v>b) return gcd(b,v);
                	if(v==b) return b;
                	if(b%v==0) return v;
                	return gcd(v,b%v);
                }
                            double dot(Vector a,Vector b){
                            	return a.x*b.x+a.y*b.y;
                            }
                            double cross(Vector a,Vector b){
                            	return a.x*b.y-a.y*b.x;
                            }
                        
                double distans(double x1,double y1,double x2,double y2){
                	double rr=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
                	return sqrt(rr);
                	
                }
                /*}
int pr[100010];
//int inv[100010];
 
int beki(int wa,int rr){
	if(rr==0) return 1ll;
	if(rr==1) return wa;
	if(rr%2==1) return (beki(wa,rr-1)*wa)%inf;
	int zx=beki(wa,rr/2);
	return (zx*zx)%inf;
}
  
void gya(){
	pr[0]=1;
	for(int i=1;i<100010;i++){
		pr[i]=(pr[i-1]*i)%inf;
	}
	for(int i=0;i<100010;i++) inv[i]=beki(pr[i],inf-2);
	
}

*/

                         //----------------kokomade tenpure------------
double px[200],py[200],pz[200],r[200],vx[200],vy[200],vz[200],vr[200],vt[200];
priority_queue<pal, vector<pal>, greater<pal> > pq;
double eps=0.000000001;
void cul(int i,int j){
	
	double a[3],b[3];
	a[0]=px[i]-px[j];
	a[1]=py[i]-py[j];
	a[2]=pz[i]-pz[j];
	b[0]=vx[i]-vx[j];
	b[1]=vy[i]-vy[j];
	b[2]=vz[i]-vz[j];
	double e=0.0,f=0.0,g=0.0,a1,a2,a3;
	for(int i=0;i<3;i++){
		g += a[i]*a[i];
		f += 2*a[i]*b[i];
		e += b[i]*b[i];
	}
	
	double d=vr[i]+vr[j],c=r[i]+r[j];
	a1=e-d*d;
	a2=f+2*d*c;
	a3=g-c*c;
	//if(i==0&&j==2)	cout<<e<<" "<<f<<" "<<g<<endl;
	if(abs(a1)<eps && abs(a2)<eps) return ;
	if(abs(a1)<eps){
		if(-a3/a2>eps){
			double ty=-a3/a2;
		if(ty<vt[i] && ty <vt[j] && ty>eps)	pq.push(mp(ty,mp(i,j)));
		}
		return;
	}
	if(a2*a2-4.0*a1*a3<=eps) return;
	double q1,q2;
	q1=(-a2-sqrt(a2*a2-4.0*a1*a3))/(2.0*a1);
	q2=(-a2+sqrt(a2*a2-4.0*a1*a3))/(2.0*a1);
	if(q1>q2) swap(q1,q2);
	
	if(q2<eps) return;
	
	if(q1<eps){
	if(q2<vt[i] && q2<vt[j] && q2>eps)	pq.push(mp(q2,mp(i,j)));
	}
	else {
	if(q1<vt[i] && q1<vt[j] &&q1>eps)	pq.push(mp(q1,mp(i,j)));
	}
	return ;
}

string s[50],t[50];
signed main(){
	int n,m;
	/*
	double d;
	cin>>d;
	
	double ans=0;
	for(int i=0;i<=10;i++){
		if(i>d) break;
		double ii=i+0.0;
		ans=max(ans,sqrt(d*d-ii*ii));
	}
	printf("%.10lf\n",ans);
	*/
	
	while(1){
	cin>>n;
		//int sumi[200]={0};
		if(n==0) return 0;
		for(int i=0;i<n;i++){
			cin>>s[i];
			t[i]="";
		//	cout<<s[i]<<endl;
		}
		
		for(int i=0;i<n;i++){
			t[i]=s[i].substr(0,1);
		//	cout<<t[i]<<endl;
			for(int j=1;j<s[i].length();j++){
				if(s[i][j-1]=='a'||s[i][j-1]=='u'||s[i][j-1]=='i'||s[i][j-1]=='e'||s[i][j-1]=='o'){
					t[i] += s[i].substr(j,1);
				//	cout<<t[i]<<endl;
				}
			}
		//	cout<<t[i]<<endl;
		}
		int ans=1;
		while(1){
			set<string> se;
			for(int i=0;i<n;i++)se.insert(t[i].substr(0,ans)); 
			if(se.size()==n)break;
			
			ans++;
			
			if(ans>69) break;
		}
		
		
		if(ans>60)ans=-1;
		cout<<ans<<endl;
		
		//cout<<ans<<endl;
		
		
	}
	
	
	return 0;
}

Measured memory_bytes: 3200