#include <iostream>
#include <string>
#include <vector>
using namespace std;

int check(string s1,string s2){
	int res = 0;
	bool flag = true;
	if(s1 == s2)return -1;
	for(int i = 0;i < min(s1.size(),s2.size());i++){
		res++;
		if(s1[i] != s2[i]){
			flag = false;
			break;
		}
	}
	if(flag && s1.size() == s2.size()){
		return -1;
	}
	else if(!flag){
		return res;
	}
	else return res+1;
}

string makes(string s){
	string s1 = "";
	s1 += 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'){
			s1 += s[i+1];
		}
	}
	return s1;
}

int main(){
	int n,res;
	string s;
	vector<string> vec;
	bool flag;
	while(1){
		res = 0;
		vec.clear();
		cin >> n;
		if(n == 0)break;
		flag = true;
		for(int i = 0;i < n;i++){
			cin >> s;
			vec.push_back(makes(s));
		}
		for(int i = 0;i < vec.size()-1;i++){
			for(int j = i+1;j < vec.size();j++){
				if(check(vec[i],vec[j]) == -1){
					res = -1;
					flag = false;
					break;
				}
				else{
					res = max(res,check(vec[i],vec[j]));
				}
			}
			if(!flag)break;
		}
		cout << res <<endl;
	}
	return 0;
}