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

int n;
string s[50];

int main() {
	while (cin >> n) {
		if (n == 0) { break; }
		
		int i, j, k;
		
		for (i = 0; i < n; i++) { cin >> s[i]; }
		
		for (i = 1; i <= 50; i++) {	//??????i??????
			set<string> codes;
			for (j = 0; j < n; j++) {	//j????????????????????????
				string str;
				str += s[j][0];
				for (k = 1; k < s[j].length(); k++) {
					if (s[j][k-1] == 'a' || s[j][k-1] == 'i' || s[j][k-1] == 'u' || s[j][k-1] == 'e' || s[j][k-1] == 'o') {
						if (str.length() < i) { str += s[j][k]; }
					}
				}
				codes.insert(str);
			}
			if (codes.size() == n) {
				cout << i << endl;
				break;
			}
		}
		if (i > 50) {
			cout << -1 << endl;
		}
	}
	return 0;
}