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

int N;
vector<string> S;

bool is_vowel(char c){
    string s = "aiueo";
    for(char v: s) if(c == v)
        return true;
    return false;
}

int solve(){
    vector<string> codes;
    
    int n = 100;
    for(auto s: S){
        string t = "";
        t += s[0];
        for(int i=0; i<s.size()-1; i++){
            if(is_vowel(s[i]))
                t += s[i+1];
        }
        n = min(n, (int)t.size());
        codes.push_back(t);
    }
    
    for(int k=1; k<=100; k++){
        set<string> set;
        for(auto t: codes){
            set.insert(t.substr(0, k));
        }
        if(set.size() == N)
            return k;
    }
    
    return -1;
}

int main(){
    while(cin >> N, N){
        S.resize(N);
        for(auto &v: S) cin >> v;
        
        cout << solve() << endl;
    }
    
    return 0;
}