#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	complex<long double>cmpmp;
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	while (1) {
		string str[100], str2[100];
		long long int n, maxboin = 0,minboin=99999, mmm = 0;
		cin >> n;
		if (n == 0) { return 0; }
		for (int i = 0; i < n; i++) {
			cin >> str[i];
			long long int tmp = 1;
			str2[i].push_back(str[i][0]);
			for (int j = 1; j < str[i].length(); j++) {
				if (str[i][j - 1] == 'a' || str[i][j - 1] == 'i' || str[i][j - 1] == 'u' || str[i][j - 1] == 'e' || str[i][j - 1] == 'o') {
					tmp++;
					str2[i].push_back(str[i][j]);
				}
			}
			maxboin = max(tmp, maxboin);
		}


		string code_name[60];

		for (int k = 1; k <= maxboin; k++) {
			for (int i = 0; i < n; i++) {
				code_name[i]=str2[i].substr(0,min(k,(int)str2[i].length()));
			}
			for (int i = 0; i < n; i++) {
				for (int j = i+1; j < n; j++) {
					if (code_name[i] == code_name[j]) {
						goto next;
					}
				}
			}
			cout << k << endl;
			break;
		next:
			if (k == maxboin) { cout << -1 << endl; }
			mmm++;
		}
	}
}
