class AirportCodes
{
	private static bool isVowel(char c) { // ????????????????????????
		bool ret = false;
		switch(c) { // ??????????????????????????¢??????????????¨?????????
	  	  case 'a': ret = true ; break;
	  	  case 'i': ret = true ; break;
	  	  case 'u': ret = true ; break;
	  	  case 'e': ret = true ; break;
	  	  case 'o': ret = true ; break;
	  	  default:  ret = false; break;
		}
		return ret;
	}
	
	private static string[] formatAirPortName(string[] input) {
		string[] output = new string[input.Length];
		for (int i = 0; i < input.Length; ++i) {
			//System.Console.WriteLine("in: {0}", input[i]);
			output[i] = input[i][0].ToString();

			bool prevIsVowel = isVowel(input[i][0]); // prevIsVowel: ????????????????????§outputStr?????????j?????¢???????????????????????????
			for (int j = 1; j < input[i].Length; ++j) {
				if (prevIsVowel) {
					output[i] = output[i] + input[i][j];
				}
				prevIsVowel = isVowel(input[i][j]);
			}
			//System.Console.WriteLine("out: {0}", output[i]);
		}
		return output;
	}
	
	private static bool hasDuplicateCode(string[] input, int codeLength) {// input????????????????????????????????????????????¨????????????
		bool ret = false;

		string prevStr;
		try   { prevStr = input[0].Substring(0, codeLength); }
		catch { prevStr = ""; }

		for (int i = 1; i < input.Length; ++i) {
			string currentStr;
			try   { currentStr = input[i].Substring(0, codeLength); }
			catch { continue; }
			if (prevStr == currentStr) {
				ret = true;
				break;
			}
			prevStr = currentStr; // ?????????????????????????????????????????§??????????????????????????£??\?????????????????¨???????????§????????§??????
		}

		return ret;
	}
	
	private static int getMaxLength(string[] formatStr) {
		int max = 0;
		for (int i = 0; i < formatStr.Length; ++i) {
			if (formatStr[i].Length > max) {
				max = formatStr[i].Length;
			}
		}
		return max;
	}
	
	private static bool hasSameCode(string[] formatStr) {
		bool ret = false;
		// ?????????????????????????????????????????§??????????????????????????£??\?????????????????¨???????????§????????§??????
		string prevStr = formatStr[0];
		for (int i = 1; i < formatStr.Length; ++i) {
			if (prevStr == formatStr[i]) {
				ret = true;
				break;
			}
			prevStr = formatStr[i];
		}
		return ret;
	}

	public static void Main()
	{
		int portCount;
		
		while (0 != (portCount = int.Parse(System.Console.ReadLine()))) {
			string[] inputStr = new string[portCount];
			for (int i = 0; i < portCount; ++i) {
				inputStr[i] = System.Console.ReadLine();
			}
			string[] formatStr = formatAirPortName(inputStr); //????????????????????????
			System.Array.Sort(formatStr); // ???????????????
			
			int ret = -1;
			if (hasSameCode(formatStr)) {// ??¨?????????????????????????????´??????????´¢???????????§?????????-1
				System.Console.WriteLine("{0}", ret);
				continue;
			}
			
			int maxLength = getMaxLength(formatStr);
			for (int k = 1; k <= maxLength; ++k) { // ????????????????????????????´¢
				if (!hasDuplicateCode(formatStr, k)) {
					ret = k;
					System.Console.WriteLine("{0}", ret);
					break;
				}
			}
			if (ret == -1) {
				System.Console.WriteLine("{0}", ret);
			}
		}
	}
};

Measured memory_bytes: 10180