#include <bits/stdc++.h>
using namespace std;

#define rep(i,x,y) for(int i=(x); i < (y); i++)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " L:" << __LINE__ << ")" << std::endl;
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

using i64=int64_t;

string ryaku(string s, int k) {
	string ret = string(1, s[0]);
	if (k == 1) return ret;
	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') {
			ret = ret + s[i + 1];
			if (k == ret.size()) break;
		}
	}
	return ret;
}

void solve(vector<string> &S) {
	int n = S.size();
	int kmax = 0;
	for(int i = 0; i < n; i++) {
		kmax = max(kmax, (int)S[i].size());
	}
	for(int k = 1; k <= kmax; k++) {
		set<string> M;
		bool flag = true;
		for(int i = 0; i < n; i++) {
			string r = ryaku(S[i], k);
			if (M.find(r) != M.end()) {
				flag = false;
				break;
			}
			M.insert(r);
		}
		if (flag) {
			cout << k << endl;
			return;
		}
	}
	cout << "-1" << endl;
}

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(16);
	
	int n;
	while(cin >> n, n) {

		vector<string> S;
		for(int i = 0; i < n; i++) {
			string s;
			cin >> s;
			S.push_back(s);
		}
		solve(S);
	}

	return 0;
}