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

int n, k;
string s[15];
int hashes[15];
int br[15];

string subtask1(){
    string rs = "";
    queue <string> q;
    q.push("a");
    q.push("b");
    while(!q.empty()){
        string str = q.front();
        q.pop();
        int x = str.size();
        for(int j=1; j<=n; j++){
            br[j] = 0;
        }
        for(int i=0; i<x; i++){
            for(int j=1; j<=n; j++){
                if(i+s[j].size()-1 >= x) continue;
                for(int k=0; k<s[j].size(); k++){
                    if(str[i+k] != s[j][k]) break;
                    if(k == s[j].size()-1) br[j]++;
                }
            }
        }
        for(int j=1; j<=n; j++){
            if(br[j] != 1) break;
            if(j == n){
                return str;
            }
        }
        if(str.size() < 18){
            q.push(str+'a');
            q.push(str+'b');
        }
    }
    return rs;
}

int Resi(int N, int K, int* L, char** A, char* S){
    n = N;
    k = K;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=L[i]; j++){
            s[i] += A[i][j];
        }
    }
    if(K == 2){
        string g = subtask1();
        if(g.size() == 0){
            return -1;
        }
        int cnt = 0;
        for(auto c : g){
            cnt++;
            S[cnt] = c;
        }
        return cnt;
    }
    return -1;
}

/*int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int N, K;
	cin >> N >> K;
	char** A = new char*[N+1];
	int* L = new int[N+1];
	char* S = new char[65536];
	for (int i=1; i<=N; i++) {
		string s;
		cin >> s;
		A[i] = new char[s.size() + 2];
		copy(s.begin(), s.end(), A[i]+1);
		A[i][s.size() + 1] = 0;
		L[i] = s.size();
	}
	int res = Resi(N, K, L, A, S);
	cout << res << '\n';
	if (res >= 0) {
		for (int i=1; i<=res; i++)
			cout << S[i];
		cout << '\n';
	}
	for (int i=1; i<=N; i++)
		delete[] A[i];
	delete[] A;
	delete[] L;
	delete[] S;
}*/