#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; 
  while(cin >> n, n) {
    vector<string> vs(n);
    FOR(i,0,n) cin >> vs[i];
    string a = "aiueo";
    bool ok = true;
    FOR(k,1,60) {
      set<string> SET;
      ok = true;
      FOR(i,0,n) {
        string s = "";
        s = s + vs[i][0];
        FOR(j,0,vs[i].length()-1) {
          if(s.length() == k) break;
          FOR(m,0,5) {
            if(vs[i][j] == a[m]) {
              s += vs[i][j+1];
              break;
            }
          }
        }
        if(SET.count(s)) {
          ok = false;
          break;
        }
        SET.insert(s);
      }
      if(ok) {
        cout << k << endl;
        break;
      }
    }
    if(!ok) cout << -1 << endl;
  }
  return 0;
}