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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    int N;
    const string V = "aiueo";

    while (cin >> N, N) {
        vector<string> S(N);
        rep(i, N) cin >> S[i];

        for (int k=1; k<=50; k++) {
            set<string> vis;
            bool ok = true;
            for (auto s : S) {
                s = 'a' + s;
                string tmp;
                for (int i=1; i<s.size(); i++) {
                    if (V.find(s[i-1]) != string::npos) tmp += s[i];
                    if (tmp.size() == k) break;
                }
                if (vis.count(tmp)) {
                    ok = false;
                    break;
                }
                vis.insert(tmp);
            }
            if (ok) {
                cout << k << endl;
                goto next;
            }
        }
        cout << -1 << endl;
        next:;
    }
}