#include<iostream>
#include<string>
#include<string.h>

using namespace std;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		
		string code[50];
		for(int i = 0;i < 50;i++){
			code[i] = "";
		}
		
		for(int i = 0;i < n;i++){
			string ts;
			cin >> ts;
			for(int j = 0;j < ts.size();j++){
				if(j == 0){
					code[i] += ts[j];
				}
				if(ts[j] == 'a' || ts[j] == 'i' || ts[j] == 'u' || ts[j] == 'e' || ts[j] == 'o' && j != ts.size()-1){
					code[i] += ts[j+1];
				}
			}
		}
		
		int code_max = 0;
		for(int i = 0;i < n;i++){
			if(code_max < code[i].size()){
				code_max = code[i].size();
			}
		}
		
		int ans = -1;
		for(int i = 1;i <= code_max;i++){
			int snum = 0;
			for(int j = 0;j < n;j++){
				for(int k = 0;k < n;k++){
					if(j != k && code[j].substr(0,i) == code[k].substr(0,i)){
						snum++;
						break;
					}
				}
			}
			if(snum == 0){
				ans = i;
				break;
			}
		}
		cout << ans << endl;
	}
	return 0;
}
