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

bool isVowel(char c) { return c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'; }

void solve(int N, const vector< string >& base) {	
	for (int k=1; k<55; ++k) {
		set< string > name_set;
		for (int i=0; i<N; ++i) {
			if ((int)base[i].size() <= k) name_set.insert(base[i]);
			else name_set.insert(base[i].substr(0, k));
		}
		if ((int)name_set.size() == N) {
			cout << k << endl;
			return;
		}
	}
	puts("-1");
}

int main() {
	int N;
	while (cin >> N, N) {
		vector< string > base(N);
		for (int i=0; i<N; ++i) {
			string S;
			cin >> S;
			base[i] += S[0];
		
			int m = S.size();
			for (int j=0; j<m-1; ++j) if (isVowel(S[j])) base[i] += S[j+1];
		}
		
		solve(N, base);
	}
}
