#include "bits/stdc++.h"

using namespace std;

int n;
vector<string> s;

bool isvowel(char c)
{
  static const string vowel = "aiueo";
  for (int i = 0; i < 5; i++) {
    if (c == vowel[i]) return true;
  }
  return false;
}

string getname(string str)
{
  string res;
  res += str[0];
  for(int i = 1; i < str.size(); i++) {
    if(isvowel(str[i - 1])) {
      res += str[i];
    }
  }
  return res;
}

bool enough(int size)
{
  for(int i = 1; i < n; i++) {
    if (s[i].substr(0, min<int>(s[i].size(), size)) == s[i - 1].substr(0, min<int>(s[i - 1].size(), size))) return false;
  }
  return true;
}

static void solve()
{
  while(cin >> n && n) {
    s.resize(n);
    int start = 1, end = 50;
    int max_size = 0;
    for(int i = 0; i < n; i++) {
      cin >> s[i];
      s[i] = getname(s[i]);
      max_size = max<int>(max_size, s[i].size());
    }
    sort(s.begin(), s.end());
    while(start < end && start <= max_size) {
      int middle = (start + end) / 2;
      if (enough(middle)) {
        end = middle;
      }
      else {
        start = middle + 1;
      }
    }
    if(max_size < start) {
      cout << "-1\n";
    }
    else {
      cout << start << "\n";
    }
  }
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie();
  solve();
}