#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>

using namespace std;

#define MY_BIG_INT long long

class MYCP {
public:

	//数値を区切って文字列にする
	static string MakeString_LongLong(vector<long long> const& numbers,string const& str) {
		if (numbers.size() == 0)return "";
		string result = "" + to_string(numbers[0]);
		for (long long i = 1;i < numbers.size();i++) {
			result += str;
			result += to_string(numbers[i]);
		}

		return result;
	}

	//空白で区切る為のオーバーロード
	static string MakeString_LongLong(vector<long long> const& numbers) {
		if (numbers.size() == 0)return "";
		string result = "" + to_string(numbers[0]);
		for (long long i = 1; i < numbers.size(); i++) {
			result += " ";
			result += to_string(numbers[i]);
		}

		return result;
	}



	//文字列の配列を改行を挟んでまとめる
	static string MakeString_VectorString(vector<string> const& str) {
		string result = "";
		for (long long i = 0; i < str.size(); i++) {
			result += str[i] + "\n";
		}

		return result;
	}

	//文字列を必要な個数だけ読み取る
	static vector<string> MyReadLineSplit(MY_BIG_INT n) {
		vector<string> str(n);
		for (long long i = 0;i < n;i++) {
			std::cin >> str[i];
		}

		return str;
	}

	//数値を必要な個数だけ読み取る
	static vector<long long> ReadInts(long long number) {
		vector<long long> a(number);
		for (int i = 0;i < number;i++) {
			std::cin >> a[i];
		}

		return a;
	}

	//渡された自然数が素数ならtureを返す
	static bool PrimeCheck_Int(long long number) {
		if (number < 2)return false;

		for (unsigned MY_BIG_INT i = 2;i*i <= number;i++) {
			if (number%i == 0)return false;
		}

		return true;
	}

	//渡された数値以下の素数表を作る
	static vector<long long> MakePrimeList(long long n) {
		vector<long long> list;
		MY_BIG_INT i, j, p;
		bool flag;
		for (i = 2; i <= n; i++) {
			flag = true;
			for (j = 0; j < list.size(); j++) {

				if (!(list[j] * list[j] <= i))break;

				if (i%list[j] == 0) {
					flag = false;
					break;
				}
			}
			if (flag)list.push_back(i);
		}

		return list;
	}

	

	//文字列の分割
	static vector<string> split(string const& str, char sep)
	{
		vector<std::string> v;        // 分割結果を格納するベクター
		auto first = str.begin();              // テキストの最初を指すイテレータ
		while (first != str.end()) {         // テキストが残っている間ループ
			auto last = first;                      // 分割文字列末尾へのイテレータ
			while (last != str.end() && *last != sep)       // 末尾 or セパレータ文字まで進める
				last++;
			v.push_back(string(first, last));       // 分割文字を出力
			if (last != str.end())
				last++;
			first = last;          // 次の処理のためにイテレータを設定
		}
		return v;
	}

	//最初に呼び出す
	static void SetUp() {
		cin.tie(0);
		ios::sync_with_stdio(false);
	}
};

//累積和を求めるクラス
class Syakutori {
private:
	vector<MY_BIG_INT> list;

public:

	void MakeArray(vector<MY_BIG_INT> data) {
		MY_BIG_INT i;
		list = data;
		list.push_back(0);
		list[0] = 0;
		for (i = 1; i < list.size(); i++) {
			list[i] = list[i - 1] + data[i - 1];
		}
		
	}

	MY_BIG_INT Sum(MY_BIG_INT start, MY_BIG_INT end) {
		if (end < start) {
			cout << "startがendより大きいです";
			return 0;
		}
		if (start < 0 || end >= list.size()) {
			cout << "範囲が異常";
			return 0;
		}

		return list[end] - list[start];
	}
};

bool Check(vector<string> name) {
	sort(name.begin(), name.end());

	for (MY_BIG_INT i = 1;i < name.size();i++) {
		if (name[i] == name[i - 1])return false;
	}

	return true;
}

bool Boin(char c) {
	char boin[] = { 'a','i','u','e','o' };
	for (int i = 0;i < 5;i++) {
		if (c == boin[i])return true;
	}

	return false;
}

int main(void) {
	MYCP::SetUp();

	MY_BIG_INT n, i, j, k, question;
	vector<vector<string>> s;
	while (true)
	{
		cin >> n;
		if (n == 0)break;
		auto buff = MYCP::MyReadLineSplit(n);
		s.push_back(buff);

	}

	for (question = 0;question < s.size();question++) {
		MY_BIG_INT max = 0;

		for (i = 0;i < s[question].size();i++) {
			if (max < s[question][i].size())max = s[question][i].size();
		}


		for (k = 1;k <= max;k++) {

			vector<string> name;
			string a, b;
			for (i = 0;i < s[question].size();i++) {
				a = s[question][i];

				b = a[0];

				for (j = 1;j < a.size();j++) {
					char c = a[j - 1];
					if (Boin(c)) {
						b += a[j];
					}
				}

				a = b;

				

				if (b.size() >= k) {
					b = "";
					for (j = 0;j < k;j++) {
						b += a[j];
					}
				}

				name.push_back(b);
			}

			if (Check(name)) {
				cout << k << endl;
				break;
			}

			if (k == max)cout << -1 << endl;
		}
	}

	
	
}


Measured memory_bytes: 3344