#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	string mo = "aiueo";
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<string>ports;
		for (int i = 0; i < N; ++i) {
			string st; cin >> st;
			ports.emplace_back(st);
		}
		int ans = -1;
		for (int k = 1; k <= 50; ++k) {
			set<string>sts;
			for (int i = 0; i < N; ++i) {
				string name;
				string st = ports[i];
				name.push_back(st[0]);
				for (int j = 0; j < st.size() - 1; ++j) {
					if (find(mo.begin(), mo.end(), st[j]) == mo.end()) {

					}
					else {
						name.push_back(st[j + 1]);
					}
				}
				if (name.size() > k)name = name.substr(0, k);
				sts.emplace(name);
			}
			if (sts.size() == N) {
				ans = k;
				break;
			}
		}
		cout << ans << endl;
		

	}
	
	return 0;
}