#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

bool is_vowel(char ch) {
    return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
}

int N;
string S[50];

string T[50];

int solve() {
    for (int i = 0; i < N; ++i) T[i] = "";

    int lim = 0;
    for (int i = 0; i < N; ++i) {
        T[i] += S[i][0];

        for (int j = 1; j < S[i].size(); ++j) {
            if (is_vowel(S[i][j-1]))
                T[i] += S[i][j];
        }
        lim = max(lim, (int)T[i].size());
    }

    for (int k = 1; k <= lim; ++k) {
        bool ok = true;
        for (int i = 0; i < N; ++i) {
            for (int j = i+1; j < N; ++j) {
                string ti = T[i].substr(0, min(k, (int)T[i].size()));
                string tj = T[j].substr(0, min(k, (int)T[j].size()));

                if (ti == tj)
                    ok = false;
            }
        }

        if (ok) return k;
    }

    return -1;
}

int main(){while(1){
    cin >> N;
    if (N == 0) break;
    for (int i = 0; i < N; ++i)
        cin >> S[i];
    cout << solve() << endl;
}
return 0;
}

