#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;

int dx[6] = { 1,1, 0,0,-1,-1 };
int dy[6] = { 0,1,-1,1,-1, 0 };

bool solve()
{
	int n; cin >> n;
	if (n == 0)return false;

	vector<string> S(n);

	int maxK = 0;
	
	for (int i = 0; i < n; ++i)
	{
		string s;
		cin >> s;

		S[i].push_back(s[0]);
		for (int j = 0; j < s.length()-1; ++j)
		{
			if (s[j] == 'a' || s[j] == 'i' || s[j] == 'u' || s[j] == 'e' || s[j] == 'o')
			{
				S[i].push_back(s[j + 1]);
			}
		}
		maxK = max(maxK, (int)S[i].length());
	}

	for (int k = 1; k <= maxK; ++k)
	{
		unordered_map<string, int> mp;
		bool flag = true;
		for (auto & s : S)
		{
			
			if (mp.find(s.substr(0,k))!=mp.end())
			{
				flag = false;
				break;
			}
			mp[s.substr(0, k)] = 1;
		}

		if (flag)
		{
			cout << k << endl;
			return true;
		}
	}

	cout << -1 << endl;

	return true;
}

int main()
{
	while (solve());

	return 0;
}
