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

int main(int argc, char const *argv[])
{
	int n;
	while(1)
	{
		cin >> n;
		if(n==0) break;
		string s[n];
		for (int i = 0; i < n; ++i) cin >> s[i];
		string code[n];
		int ma=0;
		for (int i = 0; i < n; ++i)
		{
			string tmp;
			tmp.push_back(s[i].at(0));
			for (int j = 0; j < s[i].size()-1; ++j)
			{
				if(s[i].at(j)=='a'||s[i].at(j)=='e'||s[i].at(j)=='i'||s[i].at(j)=='o'||s[i].at(j)=='u')
				{
					tmp.push_back(s[i].at(j+1));
				}
			}
			ma = max(ma, (int)tmp.size());
			code[i]=tmp;
		}

		bool f=1;
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				if(i==j) continue;
				if(code[i]==code[j]) f=0;
			}
		}
		if (f)
		{
			int ans=0;
			for (int i = 0; i < n; ++i)
			{
				for (int j = 0; j < n; ++j)
				{
					if(i==j) continue;
					int k=0;
					while(k<code[i].size()&&k<code[j].size()&&code[i].at(k)==code[j].at(k)) ++k;
					ans = max(ans, k);
				}
			}
			++ans;
			cout << ans << endl;
		}
		else cout << -1 << endl;
	}
	return 0;
}
