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

int main(){

    while(1){
        int n; cin >> n;
        if(n == 0) break;
        vector<string> s(n);
        for(int i = 0; i < n; i++){
            string input; cin >> input;
            s[i] = input[0];
            for(int j = 1; j < input.size(); j++){
                char c = input[j - 1];
                if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
                    s[i] = s[i] + input[j];
                }
            }
        }

        int ans = -1;

        for(int k = 1; k <= 100; k++){
            set<string> S;

            for(int i = 0; i < n; i++){
                if(s[i].size() > k){
                    //cout << s[i].substr(0, k) << endl;
                    S.insert(s[i].substr(0, k));
                }
                else S.insert(s[i]);
            }

                //cout << S.size() << endl;
                if(S.size() == n){
                    ans = k;
                    break;
                }
            
        }

        cout << ans << endl;
        
    }

    return 0;
}