#include<bits/stdc++.h>
using namespace std;
int n,k;
string s[4],ans="aaaa";
string qua;
char vowel[5]={'a','e','i','o','u'};
bool isVowel(char x){
	for(int i=0;i<5;i++){
		if(vowel[i]==x) return true;
	}
	return false;
}
string rhyme(){
	string ret="abbb";
	string a,b;
	int mc=0,mi=0;
	int cnt=0,p=s[0].length()-1;
	while(cnt!=k&&p>=0){
		a+=s[0][p];
		if(isVowel(s[0][p])) cnt++;
		p--;
	}
	if(cnt!=k) return ret;
	for(int i=1;i<4;i++){
		b="";
		cnt=0,p=s[i].length()-1;
		while(cnt!=k&&p>=0){
			b+=s[i][p];
			if(isVowel(s[i][p])) cnt++;
			p--;
		}
		if(cnt!=k) continue;
		if(a==b){
			mc++;
			mi=i;
		}
	}
	if(mc==1){
		ret[mi]='a';
	}
	else if(mc==3){
		ret="aaaa";
	}
	return ret;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		for(int j=0;j<4;j++) cin>>s[j];
		qua=rhyme();
		if(ans!=qua){
			if(ans=="aaaa") ans=qua;
			else if(qua=="aaaa") continue;
			else{
				cout<<"NO\n";
				return 0;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<string> ss;
string ans="aaaa";
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		string tmp;
		ss.clear();
		for(int j=0;j<4;j++){
			string s;
			cin>>s;
			int cnt=0,p=s.length()-1;
			while(p>=0){
				if(strchr("aeiou",s[p])!=NULL) cnt++;
				if(cnt==k){
					ss.push_back(s.substr(p));
					break;
				}
				p--;
			}
		}
		if(ss.size()<4) tmp="NO";
		else if(ss[0]==ss[1]&&ss[1]==ss[2]&&ss[2]==ss[3]) tmp="aaaa";
		else if(ss[0]==ss[1]&&ss[2]==ss[3]) tmp="aabb";
		else if(ss[0]==ss[2]&&ss[1]==ss[3]) tmp="abab";
		else if(ss[0]==ss[3]&&ss[1]==ss[2]) tmp="abba";
		else tmp="NO";
		if(ans=="aaaa") ans=tmp;
		else if(tmp=="aaaa"||ans==tmp);
		else ans="NO";
	}
	cout<<ans<<endl;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<string> typ = { "aaaa", "aabb", "abab", "abba" };
int cal(string  A , string B , int k){
	bool find = 0, a = 0, b = 0;
	while (!A.empty() && !B.empty()){
		char q, qq;
		if (A.back() == 'e' || A.back() == 'o' || A.back() == 'a' || A.back() == 'i' || A.back() == 'u'){
			a++;
			q = A.back();
			if (B.back() == 'e' || B.back() == 'o' || B.back() == 'a' || B.back() == 'i' || B.back() == 'u'){
				qq = B.back();
				if(q == qq) find = 1;
				b++;
			}
		}
		if (find == 0 && A.back() != B.back() || a >= k && b >= k)
			break;
		A.pop_back();
		B.pop_back();
	}
	return find;
}
int main()
{
	string s;
	int n , k;
	while (cin >> n >> k){
		string ar[4] , cur ;
		V<int>tp(n);
		int ok = 1;
		V<pair<int, int> > sr = { { 0, 1 }, { 2, 3 }, { 1, 2 } };
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> ar[j];
			}
			int q = 0, q1 = 0, q2 = 0;
			for (int j = 0; j < sr.size(); j++){
				int l = sr[j].first, r = sr[j].second;
				int find = cal(ar[l] , ar[r] , k);
				if (j == 0) q = find;
				else if (j == 2) q1 = find;
				else if(j == 1) q2 = find;
			}
			if (q == 1 && q2 == 1 && q1 == 1){
				if (cur.size() == 0) cur = "aaaa";
			}
			else if (q == 1 && q1 == 0 && q2 == 1){
				if (cur.size() == 0 || cur == "aabb" || cur == "aaaa") cur = "aabb";
				else ok = 0;
			}
			else if (q == 0 && q2 == 0 && q1 == 1){
				if (cur.size() == 0 || cur == "abba" || cur == "aaaa") cur = "abba";
				else ok = 0;
			}
			else if (q == 0 && q2 == 0 && q1 == 0){
				if (cur.size() == 0 || cur == "abab" || cur == "aaaa") cur = "abab";
				else ok = 0;
			}
			else ok = 0;
			if (ok == 0) break;
		}
		if (ok) cout << cur << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<int>vl(26);
V<string>in(4);
bool go(string & a, string & b , int ok){
	int s2 = b.size() - 1, s1 = a.size() - 1;
	while (s1 >= 0 && s2 >= 0){
		if (a[s1] == b[s2]){
			if(vl[a[s1] - 'a'] == 1)
				ok--;
			if (ok == 0) return 1;
		}
		else break;
		s1--, s2--;
	}
	return 0;
}
int main()
{
	int n, k;
	vl['a' - 'a'] = 1 , vl['o' - 'a'] = 1 , vl['i' - 'a'] = 1 , vl['u' - 'a'] = 1 , vl['e' - 'a'] = 1;

	while (cin >> n >> k){
		string ans;
		vl.resize(26);
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> in[j];
			}
			int a = go(in[0], in[1], k), b = go(in[1], in[2], k), c = go(in[2], in[3], k);
			if (a == 1 && b == 1 && c == 1){
				if (ans.size() == 0) ans = "aaaa";
			}
			else if (a == 1 && b == 0 && c == 1) {
				if (ans.size() == 0 || ans == "aabb" || ans == "aaaa") ans = "aabb";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 0 && c == 0){
				if (ans.size() == 0 || ans == "abab" || ans == "aaaa") ans = "abab";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 1 && c == 0){
				if (ans.size() == 0 || ans == "abba" || ans == "aaaa") ans = "abba";
				else { ans = "NO"; break; }
			}
			else { ans = "NO"; break; }
		}
		cout << ans << endl;
		vl.clear();

	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<int>vl(26);
V<string>in(4);
int go(string & a, string & b , int ok){
	int size = max(a.size(), b.size()) , A = 0 , B = 0;
	for (int i = 0; i < size; i++){
		if (i < a.size() && vl[a[i] - 'a'])A++;
		if (i < b.size() && vl[b[i] - 'a'])B++;
	}
	if (min(A, B) < ok)return -1;
	int s1 = a.size() - 1, s2 = b.size() - 1;
	while (s1 >= 0 && s2 >= 0){
		if (a[s1] == b[s2]){
			if (vl[a[s1] - 'a']) ok--;
			if (ok == 0) return 1;
		}
		else break;
		s1--, s2--;
	}
	return 0;
}
int main()
{
	int n, k;
	vl['a' - 'a'] = 1 , vl['o' - 'a'] = 1 , vl['i' - 'a'] = 1 , vl['u' - 'a'] = 1 , vl['e' - 'a'] = 1;

	while (cin >> n >> k){
		string ans;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> in[j];
			}
			int a = go(in[0], in[1], k), b = go(in[1], in[2], k);
			int c = go(in[2], in[3], k);
			if (a == 1 && b == 1 && c == 1){
				if (ans.size() == 0) ans = "aaaa";
			}
			else if (a == 1 && b == 0 && c == 1) {
				if (ans.size() == 0 || ans == "aabb" || ans == "aaaa") ans = "aabb";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 0 && c == 0){
				if (ans.size() == 0 || ans == "abab" || ans == "aaaa") ans = "abab";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 1 && c == 0){
				if (ans.size() == 0 || ans == "abba" || ans == "aaaa") ans = "abba";
				else { ans = "NO"; break; }
			}
			else { ans = "NO"; break; }
		}
		cout << ans << endl;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<string> typ = { "aaaa", "aabb", "abab", "abba" };
int cal(string  A , string B , int k){
	bool find = 0 , nt = 0;
	int a = 0, b = 0;
	while (!A.empty() && !B.empty()){
		char q, qq;
		if (A.back() == 'e' || A.back() == 'o' || A.back() == 'a' || A.back() == 'i' || A.back() == 'u'){
			a++;
			q = A.back();
			if (B.back() == 'e' || B.back() == 'o' || B.back() == 'a' || B.back() == 'i' || B.back() == 'u'){
				qq = B.back();
				if(q == qq && nt == 0) find = 1;
				b++;
			}
			if (A.back() != B.back()) nt = 1;
			if (a >= k && b >= k && find == 1) break;
		}
		A.pop_back();
		B.pop_back();
	}
	return (a >= k && b >= k ? find : -1);
}
int main()
{
	string s;
	int n , k;
	while (cin >> n >> k){
		string ar[4] , cur ;
		V<int>tp(n);
		int ok = 1;
		V<pair<int, int> > sr = { { 0, 1 }, { 2, 3 }, { 1, 2 } };
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> ar[j];
			}
			int q = 0, q1 = 0, q2 = 0;
			for (int j = 0; j < sr.size(); j++){
				int l = sr[j].first, r = sr[j].second;
				int find = cal(ar[l] , ar[r] , k);
				if (j == 0) q = find;
				else if (j == 2) q1 = find;
				else if(j == 1) q2 = find;
			}
			if (q == 1 && q2 == 1 && q1 == 1){
				if (cur.size() == 0) cur = "aaaa";
			}
			else if (q == 1 && q1 == 0 && q2 == 1){
				if (cur.size() == 0 || cur == "aabb" || cur == "aaaa") cur = "aabb";
				else ok = 0;
			}
			else if (q == 0 && q2 == 0 && q1 == 1){
				if (cur.size() == 0 || cur == "abba" || cur == "aaaa") cur = "abba";
				else ok = 0;
			}
			else if (q == 0 && q2 == 0 && q1 == 0){
				if (cur.size() == 0 || cur == "abab" || cur == "aaaa") cur = "abab";
				else ok = 0;
			}
			else ok = 0;
			if (ok == 0) break;
		}
		if (ok) cout << cur << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<int>vl(26);
V<string>in(4);
int go(string & a, string & b , int ok){
	int s2 = b.size() - 1, s1 = a.size() - 1 , el = 1;
	while (s1 >= 0 && s2 >= 0){
		if (a[s1] == b[s2]|| el == 0){
			if(vl[a[s1] - 'a'] == 1)
				ok--;
			if (ok == 0 && el) return 1;
		}
		else el = 0 , s1++ , s2++;
		s1--, s2--;
	}
	if (ok <= 0) return 0;
	return -1;
}
int main()
{
	int n, k;
	vl['a' - 'a'] = 1 , vl['o' - 'a'] = 1 , vl['i' - 'a'] = 1 , vl['u' - 'a'] = 1 , vl['e' - 'a'] = 1;

	while (cin >> n >> k){
		string ans;
		vl.resize(26);
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> in[j];
			}
			int a = go(in[0], in[1], k), b = go(in[1], in[2], k), c = go(in[2], in[3], k);
			if (a == 1 && b == 1 && c == 1){
				if (ans.size() == 0) ans = "aaaa";
			}
			else if (a == 1 && b == 0 && c == 1) {
				if (ans.size() == 0 || ans == "aabb" || ans == "aaaa") ans = "aabb";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 0 && c == 0){
				if (ans.size() == 0 || ans == "abab" || ans == "aaaa") ans = "abab";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 1 && c == 0){
				if (ans.size() == 0 || ans == "abba" || ans == "aaaa") ans = "abba";
				else { ans = "NO"; break; }
			}
			else { ans = "NO"; break; }
		}
		cout << ans << endl;
		vl.clear();

	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<int>vl(26);
V<string>in(4);
int go(string & a, string & b , int ok){
	int size = max(a.size(), b.size()) , A = 0 , B = 0;
	for (int i = 0; i < size; i++){
		if (i < a.size() && vl[a[i] - 'a'])A++;
		if (i < b.size() && vl[b[i] - 'a'])B++;
	}
	if (min(A, B) < ok)return -1;
	int s1 = a.size() - 1, s2 = b.size() - 1;
	while (s1 >= 0 && s2 >= 0){
		if (a[s1] == b[s2]){
			if (vl[a[s1] - 'a']) ok--;
			if (ok == 0) return 1;
		}
		else break;
		s1--, s2--;
	}
	return 0;
}
int main()
{
	int n, k;
	vl['a' - 'a'] = 1 , vl['o' - 'a'] = 1 , vl['i' - 'a'] = 1 , vl['u' - 'a'] = 1 , vl['e' - 'a'] = 1;

	while (cin >> n >> k){
		string ans;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> in[j];
			}
			int a = go(in[0], in[1], k), b = go(in[1], in[2], k);
			int c = go(in[2], in[3], k);
			if (a == 1 && b == 1 && c == 1){
				if (ans.size() == 0) ans = "aaaa";
			}
			else if (a == 1 && b == 0 && c == 1) {
				if (ans.size() == 0 || ans == "aabb" || ans == "aaaa") ans = "aabb";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 0 && c == 0 && go(in[0] , in[2] , k) && go(in[1],in[3],k)){
				if (ans.size() == 0 || ans == "abab" || ans == "aaaa") ans = "abab";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 1 && c == 0 && go(in[0],in[3] , k)){
				if (ans.size() == 0 || ans == "abba" || ans == "aaaa") ans = "abba";
				else { ans = "NO"; break; }
			}
			else { ans = "NO"; break; }
		}
		cout << ans << endl;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<int>vl(26);
V<string>in(4);
int go(string & a, string & b , int ok){
	int s2 = b.size() - 1, s1 = a.size() - 1 , el = 1;
	while (s1 >= 0 && s2 >= 0){
		if (a[s1] == b[s2] || el == 0){
			if(vl[a[s1] - 'a'] == 1 || vl[b[s2] - 'a'] == 1)
				ok--;
			if (ok == 0 && el) return 1;
		}
		else el = 0 , s1++ , s2++;
		s1--, s2--;
	}
	while (s1 >= 0){
		if (vl[a[s1] - 'a']) ok--;
		s1--;
	}
	while (s2 >= 0){
		if (vl[b[s2] - 'a']) ok--;
		s2--;
	}
	if (ok <= 0) return 0;
	return -1;
}
int main()
{
	int n, k;
	vl['a' - 'a'] = 1 , vl['o' - 'a'] = 1 , vl['i' - 'a'] = 1 , vl['u' - 'a'] = 1 , vl['e' - 'a'] = 1;

	while (cin >> n >> k){
		string ans;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> in[j];
			}
			int a = go(in[0], in[1], k), b = go(in[1], in[2], k), c = go(in[2], in[3], k);
			if (a == 1 && b == 1 && c == 1){
				if (ans.size() == 0) ans = "aaaa";
			}
			else if (a == 1 && b == 0 && c == 1) {
				if (ans.size() == 0 || ans == "aabb" || ans == "aaaa") ans = "aabb";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 0 && c == 0){
				if (ans.size() == 0 || ans == "abab" || ans == "aaaa") ans = "abab";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 1 && c == 0){
				if (ans.size() == 0 || ans == "abba" || ans == "aaaa") ans = "abba";
				else { ans = "NO"; break; }
			}
			else { ans = "NO"; break; }
		}
		cout << ans << endl;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<int>vl(26);
V<string>in(4);
int go(string & a, string & b , int ok){
	int s2 = b.size() - 1, s1 = a.size() - 1 , el = 1 , A = 0 , B = 0 , ook = ok;
	while (s1 >= 0 && s2 >= 0){
		if (a[s1] == b[s2] || el == 0){
			if(vl[a[s1] - 'a'] == 1)
				ok--;
			if (el == 0){
				A += vl[a[s1] - 'a'];
				B += vl[b[s2] - 'a'];
			}
			if (ok == 0 && el) return 1;
		}
		else el = 0 , s1++ , s2++;
		s1--, s2--;
	}
	while (s1 >= 0){
		if (vl[a[s1] - 'a']) A++;
		s1--;
	}
	while (s2 >= 0){
		if (vl[b[s2] - 'a']) B++;
		s2--;
	}
	if (min(A,B) >= ook) return 0;
	return -1;
}
int main()
{
	int n, k;
	vl['a' - 'a'] = 1 , vl['o' - 'a'] = 1 , vl['i' - 'a'] = 1 , vl['u' - 'a'] = 1 , vl['e' - 'a'] = 1;

	while (cin >> n >> k){
		string ans;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> in[j];
			}
			int a = go(in[0], in[1], k), b = go(in[1], in[2], k);
			int c = go(in[2], in[3], k);
			if (a == 1 && b == 1 && c == 1){
				if (ans.size() == 0) ans = "aaaa";
			}
			else if (a == 1 && b == 0 && c == 1) {
				if (ans.size() == 0 || ans == "aabb" || ans == "aaaa") ans = "aabb";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 0 && c == 0){
				if (ans.size() == 0 || ans == "abab" || ans == "aaaa") ans = "abab";
				else { ans = "NO"; break; }
			}
			else if (a == 0 && b == 1 && c == 0){
				if (ans.size() == 0 || ans == "abba" || ans == "aaaa") ans = "abba";
				else { ans = "NO"; break; }
			}
			else { ans = "NO"; break; }
		}
		cout << ans << endl;
	}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define V vector
#define MP make_pair
#define MAX INT_MAX
#define MIN INT_MIN
#define all(v)  ((v).begin()), ((v).end())
#define allr(v) ((v).rbegin()), ((v).rend())
#define clr(v, d) memset(v, d, sizeof(v))
#define sf(x) scanf("%d", &x)
#define sf2(x, y) scanf("%d %d", &x, &y)
#define sf3(x, y, z) scanf("%d %d %d", &x, &y, &z)
#define sfll(x) scanf("%I64d", &x)
#define sfll2(x, y) scanf("%I64d %I64d", &x, &y)
#define sfll3(x, y, z) scanf("%I64d %I64d %I64d", &x, &y, &z)
//ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
int dx[]{1, -1, 0, 0, 1, -1, 1, -1};
int dy[]{0, 0, 1, -1, 1, -1, -1, 1};
typedef unsigned long long          ull;
typedef long long                   ll;
typedef long double                 LD;
V<string> typ = { "aaaa", "aabb", "abab", "abba" };
int cal(string  A , string B , int k){
	bool find = 0, a = 0, b = 0;
	while (!A.empty() && !B.empty()){
		char q, qq;
		if (A.back() == 'e' || A.back() == 'o' || A.back() == 'a' || A.back() == 'i' || A.back() == 'u'){
			a++;
			q = A.back();
			if (B.back() == 'e' || B.back() == 'o' || B.back() == 'a' || B.back() == 'i' || B.back() == 'u'){
				qq = B.back();
				if(q == qq) find = 1;
				b++;
			}
		}
		if (find == 0 && A.back() != B.back() || a >= k && b >= k)
			break;
		A.pop_back();
		B.pop_back();
	}
	return (a >= k && b >= k ? find : -1);
}
int main()
{
	string s;
	int n , k;
	while (cin >> n >> k){
		string ar[4] , cur ;
		V<int>tp(n);
		int ok = 1;
		V<pair<int, int> > sr = { { 0, 1 }, { 2, 3 }, { 1, 2 } };
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 4; j++){
				cin >> ar[j];
			}
			int q = 0, q1 = 0, q2 = 0;
			for (int j = 0; j < sr.size(); j++){
				int l = sr[j].first, r = sr[j].second;
				int find = cal(ar[l] , ar[r] , k);
				if (j == 0) q = find;
				else if (j == 2) q1 = find;
				else if(j == 1) q2 = find;
			}
			if (q == 1 && q2 == 1 && q1 == 1){
				if (cur.size() == 0) cur = "aaaa";
			}
			else if (q == 1 && q1 == 0 && q2 == 1){
				if (cur.size() == 0 || cur == "aabb" || cur == "aaaa") cur = "aabb";
				else ok = 0;
			}
			else if (q == 0 && q2 == 0 && q1 == 1){
				if (cur.size() == 0 || cur == "abba" || cur == "aaaa") cur = "abba";
				else ok = 0;
			}
			else if (q == 0 && q2 == 0 && q1 == 0){
				if (cur.size() == 0 || cur == "abab" || cur == "aaaa") cur = "abab";
				else ok = 0;
			}
			else ok = 0;
			if (ok == 0) break;
		}
		if (ok) cout << cur << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <string>
using namespace std;
const string tp[4] = {"aaaa", "aabb", "abab", "abba"};
int n;
int m, k;
string w[10000];
int main() {
	cin >> n >> k;
	n *= 4;
	int bad = 0;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		w[i] = "";
		int l = 0;
		while (l < k && s.size()) {
			char c = s[s.size() - 1];
			w[i] += c;
			s.erase(s.size() - 1);
			if (c == 'a' || c == 'i' || c == 'e' || c == 'o' || c == 'u') l++;
		}
		if (l < k) bad = 1;
	}
	if (! bad) {
		for (int t = 0; t < 4; t++) {
			int ok2 = 1;
			for (int i = 0; i < n; i += 4) {
				int ok = 1;
				for (int p = 0; p < 4 && ok; p++)
					for (int q = p + 1; q < 4 && ok; q++)
						if (tp[t][p] == tp[t][q] && w[i + p] != w[i + q])
							ok = 0;
				if (! ok) {
					ok2 = 0;
					break;
				}
			}
			if (ok2) {
				cout << tp[t] << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}


#include <map>
#include <iostream>
#include <string>
using namespace std;
int n, k;
string p[2600][10];
bool ok[500];
string poet[2600];
int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= 4; j++)
			cin >> p[i][j];
	ok['a'] = 1; ok['e'] = 1; ok['i'] = 1; ok['o'] = 1; ok['u'] = 1;
	for (int i = 1; i <= n; i++)
		poet[i] = "NO";
	for (int i = 1; i <= n; i++) {
		string r[10];
		for (int j = 1; j <= 4; j++) {
			int cnt = 0;
			string tmp = "NO";
			for (int l = p[i][j].size() - 1; l >= 0; l--) {
				if (ok[p[i][j][l]])
					cnt++;
				if (cnt == k) {
					tmp = p[i][j].substr(l, p[i][j].size() - l);
					break;
				}
			}
			if (tmp == "NO") {
				cout << "NO" << endl;
				return 0;
			}
			r[j] = tmp;
		}
		if (r[1] == r[2] && r[2] == r[3] && r[3] == r[4]) poet[i] = "aaaa";
		if (r[1] == r[2] && r[2] != r[3] && r[3] == r[4]) poet[i] = "aabb";
		if (r[1] == r[3] && r[1] != r[2] && r[2] == r[4]) poet[i] = "abab";
		if (r[1] == r[4] && r[1] != r[2] && r[2] == r[3]) poet[i] = "abba";
	}
	if (n == 1 && poet[1] == "NO") {
		cout << "NO" << endl;
		return 0;
	}
	for (int i = 2; i <= n; i++) {
		if (poet[i] != poet[i - 1]) {
			if (poet[i - 1] != "aaaa") {
				cout << "NO" << endl;
				return 0;
			}
			else
				poet[i - 1] = poet[i];
		}
	}
	cout << poet[n] << endl;
	return 0;
}
//2 1
//nuqfxwrb
//apqfkw
//uqfxwrb
//nhcuqfxwrb
//ogkznwncmt
//evf
//ogkznwncmt
//ogkznwncmt


#include <map>
#include <iostream>
#include <string>
using namespace std;
int n, k;
string p[2600][10];
bool ok[500];
string poet[2600];
int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= 4; j++)
			cin >> p[i][j];
	ok['a'] = 1; ok['e'] = 1; ok['i'] = 1; ok['o'] = 1; ok['u'] = 1;
	for (int i = 1; i <= n; i++)
		poet[i] = "NO";
	for (int i = 1; i <= n; i++) {
		string r[10];
		for (int j = 1; j <= 4; j++) {
			int cnt = 0;
			string tmp = "NO";
			for (int l = p[i][j].size() - 1; l >= 0; l--) {
				if (ok[p[i][j][l]])
					cnt++;
				if (cnt == k) {
					tmp = p[i][j].substr(l, p[i][j].size() - l);
					break;
				}
			}
			if (tmp == "NO") {
				cout << "NO" << endl;
				return 0;
			}
			r[j] = tmp;
		}
		if (r[1] == r[2] && r[2] == r[3] && r[3] == r[4]) poet[i] = "aaaa";
		if (r[1] == r[2] && r[2] != r[3] && r[3] == r[4]) poet[i] = "aabb";
		if (r[1] == r[3] && r[1] != r[2] && r[2] == r[4]) poet[i] = "abab";
		if (r[1] == r[4] && r[1] != r[2] && r[2] == r[3]) poet[i] = "abba";
	}
	if (n == 1 && poet[1] == "NO") {
		cout << "NO" << endl;
		return 0;
	}
	for (int i = 2; i <= n; i++) {
		if (poet[i] != poet[i - 1]) {
			if (poet[i - 1] == "aaaa")
				poet[i - 1] = poet[i];
			else {
				cout << "NO" << endl;
				return 0;
			}
		}
	}
	cout << poet[n] << endl;
	return 0;
}
//2 1
//nuqfxwrb
//apqfkw
//uqfxwrb
//nhcuqfxwrb
//ogkznwncmt
//evf
//ogkznwncmt
//ogkznwncmt


#include <map>
#include <iostream>
#include <string>
using namespace std;
int n, k;
string p[2600][10];
bool ok[500];
string poet[2600];
int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= 4; j++)
			cin >> p[i][j];
	ok['a'] = 1; ok['e'] = 1; ok['i'] = 1; ok['o'] = 1; ok['u'] = 1;
	for (int i = 1; i <= n; i++)
		poet[i] = "NO";
	for (int i = 1; i <= n; i++) {
		string r[10];
		for (int j = 1; j <= 4; j++) {
			int cnt = 0;
			string tmp = "NO";
			for (int l = p[i][j].size() - 1; l >= 0; l--) {
				if (ok[p[i][j][l]])
					cnt++;
				if (cnt == k) {
					tmp = p[i][j].substr(l, p[i][j].size() - l);
					break;
				}
			}
//			if (tmp == "NO") {
//				cout << "NO" << endl;
//				return 0;
//			}
			r[j] = tmp;
		}
		if (r[1] == r[2] && r[2] == r[3] && r[3] == r[4]) poet[i] = "aaaa";
		if (r[1] == r[2] && r[2] != r[3] && r[3] == r[4]) poet[i] = "aabb";
		if (r[1] == r[3] && r[1] != r[2] && r[2] == r[4]) poet[i] = "abab";
		if (r[1] == r[4] && r[1] != r[2] && r[2] == r[3]) poet[i] = "abba";
	}
	if (n == 1 && poet[1] == "NO") {
		cout << "NO" << endl;
		return 0;
	}
	for (int i = 2; i <= n; i++) {
		if (poet[i] != poet[i - 1]) {
			if (poet[i - 1] == "aaaa")
				poet[i - 1] = poet[i];
			else {
				cout << "NO" << endl;
				return 0;
			}
		}
	}
	cout << poet[n] << endl;
	return 0;
}
//2 1
//nuqfxwrb
//apqfkw
//uqfxwrb
//nhcuqfxwrb
//ogkznwncmt
//evf
//ogkznwncmt
//ogkznwncmt


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

using namespace std;

int n,m;
string st[2507][4];
set<string> res;

bool check(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
void nope()
{
	cout<<"NO"<<endl;
	exit(0);
}

using namespace std;
int main()
{
	cin>>n>>m;
	REP(i,n)
	{
		REP(j,4)
		{
			string s;
			cin>>s;
			int p=s.length();
			int c=0;
			while(c<m && p>0)
			{
				--p;
				if(check(s[p]))
					++c;
			}
			st[i][j]=s.substr(p);
			if(c<m)
				nope();
		}
	}
	REP(i,n)
	{
		if(st[i][0]==st[i][1] && st[i][1]==st[i][2] && st[i][2]==st[i][3]){res.insert("aaaa");}
		else if(st[i][0]==st[i][1] && st[i][2]==st[i][3] && st[i][1]!=st[i][2]){res.insert("aabb");}
		else if(st[i][0]==st[i][3] && st[i][1]==st[i][2] && st[i][0]!=st[i][1] && st[i][2]!=st[i][3]){res.insert("abba");}
		else if(st[i][0]==st[i][2] && st[i][1]==st[i][3] && st[i][0]!=st[i][1] && st[i][2]!=st[i][3]){res.insert("abab");}
	}
	if(res.size()>1)
	{
		if(res.size()==2 && *res.begin()=="aaaa")res.erase(res.begin());
		else nope();
	}
	if(res.size()<1)
		nope();
	cout<<*res.begin()<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

using namespace std;

int n,m;
string st[2507][4];
set<string> res;

bool check(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
void nope()
{
	cout<<"NO"<<endl;
	exit(0);
}

using namespace std;
int main()
{
	cin>>n>>m;
	REP(i,n)
	{
		REP(j,4)
		{
			string s;
			cin>>s;
			int p=s.length();
			int c=0;
			while(c<m && p>0)
			{
				--p;
				if(check(s[p]))
					++c;
			}
			st[i][j]=s.substr(p);
		}
	}
	REP(i,n)
	{
		if(st[i][0]==st[i][1] && st[i][1]==st[i][2] && st[i][2]==st[i][3]){res.insert("aaaa");}
		else if(st[i][0]==st[i][1] && st[i][2]==st[i][3] && st[i][1]!=st[i][2]){res.insert("aabb");}
		else if(st[i][0]==st[i][3] && st[i][1]==st[i][2] && st[i][0]!=st[i][1] && st[i][2]!=st[i][3]){res.insert("abba");}
		else if(st[i][0]==st[i][2] && st[i][1]==st[i][3] && st[i][0]!=st[i][1] && st[i][2]!=st[i][3]){res.insert("abab");}
	}
	if(res.size()>1)
	{
		if(res.size()==2 && *res.begin()=="aaaa")res.erase(res.begin());
		else nope();
	}
	if(res.size()<1)
		nope();
	cout<<*res.begin()<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

using namespace std;

int n,m;
string st[2507][4];
set<string> res;

bool check(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
void nope()
{
	cout<<"NO"<<endl;
	exit(0);
}

using namespace std;
int main()
{
	cin>>n>>m;
	REP(i,n)
	{
		REP(j,4)
		{
			string s;
			cin>>s;
			int p=s.length();
			int c=0;
			while(c<m && p>0)
			{
				--p;
				if(check(s[p]))
					++c;
			}
			st[i][j]=s.substr(p);
			if(c<m)
			{
				nope();
			}

		}
	}
	REP(i,n)
	{
		if(st[i][0]==st[i][1])
		{
			if(st[i][2]==st[i][3])
			{
				if(st[i][1]==st[i][2])
					res.insert("aaaa");
				else
					res.insert("aabb");
			}
			else
			{
				nope();
			}
		}
		else if(st[i][0]==st[i][3])
		{
			if(st[i][1]==st[i][2])
				{res.insert("abba");}
			else nope();
		}
		else if(st[i][0]==st[i][2] && st[i][1]==st[i][3] && st[i][0]!=st[i][1] && st[i][2]!=st[i][3]){res.insert("abab");}
		//else nope();
	}
	if(res.size()>1)
	{
		if(res.size()==2 && *res.begin()=="aaaa")res.erase(res.begin());
		else nope();
	}
	if(res.size()<1)
		nope();
	cout<<*res.begin()<<endl;
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <map>
using namespace std;

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	while (cin >>n>>k) {
		map<string,int> cnt;
		for (int i=0;n>i;i++) {
			string s[4];
			cin >>s[0] >>s[1]>>s[2]>>s[3];
			string check[4]={"","","",""};
			for (int j=0;4>j;j++) {
				int sz=s[j].size();
//				cout<<"s = "<<s[j]<<endl;
				int _=0;
//				cout<<"sz = "<<sz<<endl;
				for (int y=sz-1;y>=0;y--) {
//					cout<<"y = "<<y<<endl;
					check[j] += " ";
					check[j][check[j].size()-1]=s[j][y];
					if (s[j][y] == 'a' || s[j][y]=='e'||s[j][y]=='i'||s[j][y]=='o'||s[j][y]=='u') {
						_++;
						if (_ == k) break;
					}
				}
//				cout<<"_ = "<<_<<" , check[j] = "<<check[j]<<endl;
				if (_ != k) {
					check[j]=" ";
					check[j][1] = char('A' + j);
				}
			}
			if (check[0] == check[1] && check[1] == check[2] && check[2]==check[3]) {
				cnt["aaaa"]++;
				cnt["abab"]++;
				cnt["abba"]++;
				cnt["aabb"]++;
			}
			else if (check[0] == check[1] && check[2]==check[3]) {
				cnt["aabb"]++;
			}
			else if (check[0] == check[2] && check[1]==check[3]) {
				cnt["abab"]++;
			}
			else if (check[0] == check[3] && check[1]==check[2]) {
				cnt["abba"]++;
			}
		}
		if (cnt["aaaa"] == n) cout<<"aaaa"<<endl;
		else if (cnt["abab"] == n) cout<<"abab"<<endl;
		else if (cnt["abba"] == n) cout<<"abba"<<endl;
		else if (cnt["aabb"] == n) cout<<"aabb"<<endl;
		else cout<<"NO"<<endl;
	}
}


#include <iostream>
#include <stdio.h>
#include <map>
using namespace std;

 int main () {
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	while (cin >>n>>k) {
		map<string,int> cnt;
		for (int i=0;n>i;i++) {
			string s[4];
			cin >>s[0] >>s[1]>>s[2]>>s[3];
			string check[4]={"","","",""};
			for (int j=0;4>j;j++) {
				int sz=s[j].size();
//				cout<<"s = "<<s[j]<<endl;
				int _=0;
//				cout<<"sz = "<<sz<<endl;
				for (int y=sz-1;y>=0;y--) {
//					cout<<"y = "<<y<<endl;
					check[j] += " ";
					check[j][check[j].size()-1]=s[j][y];
					if (s[j][y] == 'a' || s[j][y]=='e'||s[j][y]=='i'||s[j][y]=='o'||s[j][y]=='u') {
						_++;
						if (_ == k) break;
					}
				}
//				cout<<"_ = "<<_<<" , check[j] = "<<check[j]<<endl;
				if (_ != k) {
//					cout<<"hehe"<<endl;
					check[j]=" ";
					check[j][0] = char('A' + j);
				}
			}
			if (check[0] == check[1] && check[1] == check[2] && check[2]==check[3]) {
				cnt["aaaa"]++;
				cnt["abab"]++;
				cnt["abba"]++;
				cnt["aabb"]++;
			}
			else if (check[0] == check[1] && check[2]==check[3]) {
				cnt["aabb"]++;
			}
			else if (check[0] == check[2] && check[1]==check[3]) {
				cnt["abab"]++;
			}
			else if (check[0] == check[3] && check[1]==check[2]) {
				cnt["abba"]++;
			}
		}
		if (cnt["aaaa"] == n) cout<<"aaaa"<<endl;
		else if (cnt["abab"] == n) cout<<"abab"<<endl;
		else if (cnt["abba"] == n) cout<<"abba"<<endl;
		else if (cnt["aabb"] == n) cout<<"aabb"<<endl;
		else cout<<"NO"<<endl;
//		cout<<"hahaend"<<endl;
	}
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
set<string> st;
inline bool isyuan(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
int main()
{
	cin >>n>>m;
	for (int tr=0;tr<n;tr++)
	{
		vector<string> vs;
		bool b=1;
		for (int i=0;i<4;i++)
		{
			string s;
			cin >>s;
			int fl=m-1;
			for (int j=s.size()-1;j>=0;j--)
			{
				if (isyuan(s[j]))
				{
					if (fl) fl--;
					else
					{
						fl=j;
						break;
					}
				}
			}
			if (fl) b=0;
			else
			{
				string ss=s.substr(fl);
			    vs.push_back(ss);
			}
		}
		if (!b) st.insert("cccc");
		else if (vs[0]==vs[1] && vs[0]==vs[2] && vs[0]==vs[3])
		    st.insert("aaaa");
		else if (vs[0]==vs[1] && vs[2]==vs[3] && vs[0]!=vs[2])
		    st.insert("aabb");
        else if (vs[0]==vs[2] && vs[1]==vs[3] && vs[0]!=vs[1])
            st.insert("abab");
        else if (vs[0]==vs[3] && vs[1]==vs[2] && vs[0]!=vs[1])
            st.insert("abba");
        else
            st.insert("cccc");
	}
	set<string>::iterator it=st.begin();
	if (st.size()==1)
	{
		if (*it=="cccc") cout <<"NO";
		else cout <<*it;
	}
	else if (st.size()==2 && *it=="aaaa") cout <<*(++it);
	else cout <<"NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
set<string> st;
inline bool isyuan(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
int main()
{
	cin >>n>>m;
	bool flg=0;
	for (int tr=0;tr<n;tr++)
	{
		vector<string> vs;
		bool b=1;
		for (int i=0;i<4;i++)
		{
			string s;
			cin >>s;
			int fl=m-1;
			bool ok=0;
			for (int j=s.size()-1;j>=0;j--)
			{
				if (isyuan(s[j]))
				{
					if (fl) fl--;
					else
					{
						fl=j;
						ok=1;
						break;
					}
				}
			}
			if (!ok) b=0;
			else
			{
				string ss=s.substr(fl);
			    vs.push_back(ss);
			}
		}
		if (!b) st.insert("cccc"),flg=1;
		else if (vs[0]==vs[1] && vs[0]==vs[2] && vs[0]==vs[3])
		    st.insert("aaaa");
		else if (vs[0]==vs[1] && vs[2]==vs[3] && vs[0]!=vs[2])
		    st.insert("aabb");
        else if (vs[0]==vs[2] && vs[1]==vs[3] && vs[0]!=vs[1])
            st.insert("abab");
        else if (vs[0]==vs[3] && vs[1]==vs[2] && vs[0]!=vs[1])
            st.insert("abba");
        else
            st.insert("cccc"),flg=1;
	}
	set<string>::iterator it=st.begin();
	if (flg) cout <<"NO";
	else if (st.size()==1) cout <<*it;
	else if (st.size()==2 && *it=="aaaa") cout <<*(++it);
	else cout <<"NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
set<string> st;
inline bool isyuan(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
int main()
{
	cin >>n>>m;
	for (int tr=0;tr<n;tr++)
	{
		vector<string> vs;
		bool b=1;
		for (int i=0;i<4;i++)
		{
			string s;
			cin >>s;
			int fl=m-1;
			bool ok=0;
			for (int j=s.size()-1;j>=0;j--)
			{
				if (isyuan(s[j]))
				{
					if (fl) fl--;
					else
					{
						fl=j;
						ok=1;
						break;
					}
				}
			}
			if (!ok) b=0;
			else
			{
				string ss=s.substr(fl);
			    vs.push_back(ss);
			}
		}
		if (!b) st.insert("cccc");
		else if (vs[0]==vs[1] && vs[0]==vs[2] && vs[0]==vs[3])
		    st.insert("aaaa");
		else if (vs[0]==vs[1] && vs[2]==vs[3] && vs[0]!=vs[2])
		    st.insert("aabb");
        else if (vs[0]==vs[2] && vs[1]==vs[3] && vs[0]!=vs[1])
            st.insert("abab");
        else if (vs[0]==vs[3] && vs[1]==vs[2] && vs[0]!=vs[1])
            st.insert("abba");
        else
            st.insert("cccc");
	}
	set<string>::iterator it=st.begin();
	if (st.size()==1)
	{
		if (*it=="cccc") cout <<"NO";
		else cout <<*it;
	}
	else if (st.size()==2 && *it=="aaaa") cout <<*(++it);
	else cout <<"NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
set<string> st;
inline bool isyuan(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
int main()
{
	cin >>n>>m;
	for (int tr=0;tr<n;tr++)
	{
		vector<string> vs;
		bool b=1;
		for (int i=0;i<4;i++)
		{
			string s;
			cin >>s;
			int fl=m-1;
			for (int j=s.size()-1;j>=0;j--)
			{
				if (isyuan(s[j]))
				{
					if (fl) fl--;
					else
					{
						fl=j;
						break;
					}
				}
			}
			if (fl<0) b=0;
			else
			{
				string ss=s.substr(fl);
			    vs.push_back(ss);
			}
		}
		if (!b) st.insert("cccc");
		else if (vs[0]==vs[1] && vs[0]==vs[2] && vs[0]==vs[3])
		    st.insert("aaaa");
		else if (vs[0]==vs[1] && vs[2]==vs[3] && vs[0]!=vs[2])
		    st.insert("aabb");
        else if (vs[0]==vs[2] && vs[1]==vs[3] && vs[0]!=vs[1])
            st.insert("abab");
        else if (vs[0]==vs[3] && vs[1]==vs[2] && vs[0]!=vs[1])
            st.insert("abba");
        else
            st.insert("cccc");
	}
	set<string>::iterator it=st.begin();
	if (st.size()==1)
	{
		if (*it=="cccc") cout <<"NO";
		else cout <<*it;
	}
	else if (st.size()==2 && *it=="aaaa") cout <<*(++it);
	else cout <<"NO";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
set<string> st;
inline bool isyuan(char c)
{
	return (c=='a' || c=='e' || c=='i' || c=='o' || c=='u');
}
int main()
{
	cin >>n>>m;
	bool flg=0;
	for (int tr=0;tr<n;tr++)
	{
		vector<string> vs;
		bool b=1;
		for (int i=0;i<4;i++)
		{
			string s;
			cin >>s;
			int fl=m-1;
			bool ok=0;
			for (int j=s.size()-1;j>=0;j--)
			{
				if (isyuan(s[j]))
				{
					if (fl) fl--;
					else
					{
						fl=j;
						ok=1;
						break;
					}
				}
			}
			if (!ok) b=0;
			else
			{
				string ss=s.substr(fl);
			    vs.push_back(ss);
			}
		}
		if (!b) st.insert("cccc"),flg=1;
		else if (vs[0]==vs[1] && vs[0]==vs[2] && vs[0]==vs[3])
		    st.insert("aaaa");
		else if (vs[0]==vs[1] && vs[2]==vs[3] && vs[0]!=vs[2])
		    st.insert("aabb");
        else if (vs[0]==vs[2] && vs[1]==vs[3] && vs[0]!=vs[1])
            st.insert("abab");
        else if (vs[0]==vs[3] && vs[1]==vs[2] && vs[0]!=vs[1])
            st.insert("abba");
        else
            st.insert("cccc");
	}
	set<string>::iterator it=st.begin();
	if (flg) cout <<"NO";
	else if (st.size()==1) cout <<*it;
	else if (st.size()==2 && *it=="aaaa") cout <<*(++it);
	else cout <<"NO";
	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
string s[10010];
bool abab=1,aabb=1,abba=1;
int main()
{
	cin >>n>>m;
	n*=4;
	for (int i=0;i<n;i++)
	{
		string st;
		cin >>st;
		int t=0;
		for (int j=st.size()-1;j>=0;j--)
		{
			if (strchr("aeiou",st[j])) t++;
			if (t==m)
			{
				s[i]=st.substr(j);
				break;
			}
		}
		if (s[i]=="") s[i]+=(char)('0'+(i%4));
	}
	for (int i=0;i<n;i+=4)
	{
		abab&=(s[i+0]==s[i+2] && s[i+1]==s[i+3]);
		aabb&=(s[i+0]==s[i+1] && s[i+2]==s[i+3]);
		abba&=(s[i+0]==s[i+3] && s[i+1]==s[i+2]);
	}
	if (abab&aabb&abba) cout <<"aaaa";
	else if ((abab&aabb)|(abab&abba)|(aabb&abba)) cout <<"NO";
	else if (!(abab|aabb|abba)) cout <<"NO";
	else if (abab) cout <<"abab";
	else if (aabb) cout <<"aabb";
	else cout <<"abba";
	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
string s[10010];
int main()
{
	cin >>n>>m;
	for (int i=0;i<4*n;i++)
	{
		cin >>s[i];
		int t=0;
		for (int j=s[i].size()-1;j>=0;j--)
		{
			if (s[i][j]=='a' || s[i][j]=='e' || s[i][j]=='i' || s[i][j]=='o' || s[i][j]=='u')
				t++;
			if (t==m)
			{
				s[i]=s[i].substr(j);
				break;
			}
		}
		if (t<m)
		{
			cout <<"NO";
			return 0;
		}
		//cout <<s[i]<<" ##\n";
	}
	bool aabb=1,abab=1,abba=1;
	for (int i=0;i<4*n;i+=4)
	{
		aabb&=(s[i]==s[i+1] && s[i+2]==s[i+3]);
		abab&=(s[i]==s[i+2] && s[i+1]==s[i+3]);
		abba&=(s[i]==s[i+3] && s[i+1]==s[i+2]);
	}
	//cout <<aabb<<" "<<abab<<" "<<abba<<" ##\n";
	if (aabb&abab&abba) cout <<"aaaa";
	else if (aabb)
	{
		if (abab || abba) cout <<"NO";
		else cout <<"aabb";
	}
	else if (abab)
	{
		if (aabb || abba) cout <<"NO";
		else cout <<"abab";
	}
	else if (abba)
	{
		if (abab || aabb) cout <<"NO";
		else cout <<"abba";
	}
	else cout <<"NO";
	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
string s[10010];
string res[4]={"aaaa","abab","aabb","abba"};
inline bool isvol(char c)
{
	return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
}
int main()
{
	cin >>n>>m;
	n*=4;
	for (int i=0;i<n;i++)
	{
		string st;
		cin >>st;
		int t=0;
		for (int j=st.size()-1;j>=0;j--)
		{
			s[i]+=st[j];
			if (isvol(st[j])) t++;
			if (t==m) break;
		}
	}
	for (int it=0;it<4;it++)
	{
		bool ok=1;
		for (int i=0;i<n;i+=4)
		{
			bool fl=1;
			for (int j=0;j<4;j++)
			{
				for (int k=j+1;k<4;k++)
				{
					if (res[it][j]!=res[it][k]) continue;
					if (s[i+j]!=s[i+k])
					{
						fl=0;
						break;
					}
				}
				if (!fl) break;
			}
			if (!fl)
			{
				ok=0;
				break;
			}
		}
		if (ok)
		{
			cout <<res[it];
			return 0;
		}
	}
	cout <<"NO";
	return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
string s[10010];
string res[4]={"aaaa","abab","aabb","abba"};
inline bool isvol(char c)
{
	return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
}
int main()
{
	cin >>n>>m;
	n*=4;
	for (int i=0;i<n;i++)
	{
		string st;
		cin >>st;
		int t=0;
		for (int j=st.size()-1;j>=0;j--)
		{
			s[i]+=st[j];
			if (isvol(st[j])) t++;
			if (t==m) break;
		}
		if (t<m)
		{
			cout <<"NO";
			return 0;
		}
	}
	for (int it=0;it<4;it++)
	{
		bool ok=1;
		for (int i=0;i<n;i+=4)
		{
			bool fl=1;
			for (int j=0;j<4;j++)
			{
				for (int k=j+1;k<4;k++)
				{
					if (res[it][j]!=res[it][k]) continue;
					if (s[i+j]!=s[i+k])
					{
						fl=0;
						break;
					}
				}
				if (!fl) break;
			}
			if (!fl)
			{
				ok=0;
				break;
			}
		}
		if (ok)
		{
			cout <<res[it];
			return 0;
		}
	}
	cout <<"NO";
	return 0;
}


#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int mp[26];
int id(string s,int k)
{
	for(int i=s.length()-1;i>=0;i--)
	{
		if(mp[s[i]-'a'])
		{
		k--;
		}
		if(!k)
		{
			//cout<<i<<endl;
			return i;
		}
	}
	if(k)return -1;
//	cout<<k<<endl;

}
int main(int argc, char** argv) {
	int n,k;
	mp[0]=1;
	mp['e'-'a']=1;
	mp['i'-'a']=1;
	mp['o'-'a']=1;
	mp['u'-'a']=1;
	scanf("%d%d",&n,&k);
	int fal=0,tp1=0,tp2=0,tp3=0;
	for(int i=0;i<n;i++)
	{
		string a,b,c,d;
		int fp1=0,fp2=0,fp3=0;
		cin>>a>>b>>c>>d;
		if(id(a,k)==-1||id(b,k)==-1||id(c,k)==-1||id(d,k)==-1)fal=1;
		if(a.length()-id(a,k)!=b.length()-id(b,k)||a.length()-id(a,k)!=c.length()-id(c,k)||a.length()-id(a,k)!=d.length()-id(d,k))
		{
			fal=1;
		}
		int J=id(b,k),K=id(c,k),L=id(d,k);
		for(int i=id(a,k);i<a.length();i++)
		{
		if(a[i]!=b[J]||c[K]!=d[L])
		{
		fp1++;	//cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<" "<<d[i]<<endl;
		}
		if(a[i]!=c[K]||b[J]!=d[L])
		{
		fp2++;
		}
		if(a[i]!=d[L]||b[J]!=c[K])
		{
		fp3++;
		}J++;K++;L++;
		}
		if(!fp1)tp1++;
		if(!fp2)tp2++;
		if(!fp3)tp3++;
	}//cout<<tp2<<endl;
	if(fal){printf("NO\n");return 0;}

	if(tp1==tp2&&tp3==n&&tp1==tp3){printf("aaaa\n");return 0;}
	if(tp1==n){printf("aabb");return 0;}
	if(tp2==n){printf("abab\n");return 0;}
	if(tp3==n){printf("abba\n");return 0;}
	cout<<"NO"<<endl;
	return 0;
}


#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int mp[26];
int id(string s,int k)
{
	for(int i=s.length()-1;i>=0;i--)
	{
		if(mp[s[i]-'a'])
		{
		k--;
		}
		if(!k)
		{
			//cout<<i<<endl;
			return i;
		}
	}
//	cout<<k<<endl;
	return 0;

}
int main(int argc, char** argv) {
	int n,k;
	mp[0]=1;
	mp['e'-'a']=1;
	mp['i'-'a']=1;
	mp['o'-'a']=1;
	mp['u'-'a']=1;
	scanf("%d%d",&n,&k);
	int fal=0,tp1=0,tp2=0,tp3=0,tp4=0;
	for(int i=0;i<n;i++)
	{
		string a,b,c,d;
		int fp1=0,fp2=0,fp3=0;
		cin>>a>>b>>c>>d;
		if(a.length()-id(a,k)!=b.length()-id(b,k)||a.length()-id(a,k)!=c.length()-id(c,k)||a.length()-id(a,k)!=d.length()-id(d,k))
		{
			fal=1;
		}
		int J=id(b,k),K=id(c,k),L=id(d,k);
		for(int i=id(a,k);i<a.length();i++)
		{
		if(a[i]!=b[J]||c[K]!=d[L])
		{
		fp1++;	//cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<" "<<d[i]<<endl;
		}
		if(a[i]!=c[K]||b[J]!=d[L])
		{
		fp2++;
		}
		if(a[i]!=d[L]||b[J]!=c[K])
		{
		fp3++;
		}J++;K++;L++;
		}
		if(!fp1)tp1++;
		if(!fp2)tp2++;
		if(!fp3)tp3++;
	}//cout<<tp2<<endl;
	if(fal){printf("NO\n");return 0;}

	if(tp1==tp2&&tp3==n&&tp1==tp3){printf("aaaa\n");return 0;}
	if(tp1==n){printf("aabb");return 0;}
	if(tp2==n){printf("abab\n");return 0;}
	if(tp3==n){printf("abba\n");return 0;}
	cout<<"NO"<<endl;
	return 0;
}


/* ***********************************************
Author        :Torrance_ZHANG
Created Time  :2016/4/30 20:50:27
File Name     :ceshi.cpp
************************************************ */

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
typedef long long int LL;
using namespace std;
char s[100010],ss[5][100010];
int tmp[10];
int main(){
    int n,k,l;
    while(~scanf("%d%d",&n,&k)){
        bool flag=true;
        memset(tmp,0,sizeof(tmp));
        for(int i=1; i<=n; i++){
            memset(ss,'\0',sizeof(ss));
            for(int j=1; j<=4; j++){
                scanf("%s",s);
                int pos=k;
                int len=strlen(s);
                for(l=len-1; l>=0&&pos>0; l--){
                    ss[j][len-l-1]=s[l];
                    if(s[l]=='a'||s[l]=='e'||s[l]=='i'||s[l]=='o'||s[l]=='u'){
                        pos--;
                    }
                }
                /*for(int ii=0;ii<len-l;ii++)
                    cout<<ss[j][ii]<<endl;*/
                if(pos>0)
                    flag=false;
            }
            int f12=strcmp(ss[1],ss[2]);
            int f23=strcmp(ss[2],ss[3]);
            int f14=strcmp(ss[1],ss[4]);
            int f24=strcmp(ss[2],ss[4]);
            int f34=strcmp(ss[3],ss[4]);
            int f13=strcmp(ss[1],ss[3]);
            //cout<<f12<<" "<<f13<<" "<<f14<<" "<<f23<<" "<<f24<<" "<<f34<<endl;
            if(f12==0&&f34==0&&f13==0)
                tmp[1]++;
            else if(f12==0&&f34==0&&f13!=0)
                tmp[2]++;
            else if(f13==0&&f24==0&&f12!=0)
                tmp[3]++;
            else if(f14==0&&f23==0&&f12!=0)
                tmp[4]++;
            else flag=false;
            int ans=0;
            for(int i=2; i<=4; i++){
                if(tmp[i]>0)
                    ans++;
            }
            if(ans>1)
                flag=false;
        }
        if(!flag)
            printf("NO\n");
        else{
            if(tmp[2]>0)
                printf("aabb\n");
            else if(tmp[3]>0)
                printf("abab\n");
            else if(tmp[4]>0)
                printf("abba\n");
            else printf("aaaa\n");
        }
    }
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int n, K;
int st[2520];

void solve(int tc){
	cin >> n >> K;
	string s[10010];
	for(int i=0;i<4*n;i++)cin >> s[i];
	for(int i=0;i<n;i++){
		string p[4];
		rep(j, 4){
			p[j] = "";
			int tk = K;
			for(int k=(int)s[4*i+j].length() - 1;k>=0;k--){
				char c = s[4*i+j][k];
				p[j].pb(c);
				if(c == 'i' || c == 'a' || c == 'e' || c == 'o' || c == 'u'){
					tk--;
					if(tk == 0)break;
				}
			}
			if(tk != 0){
				printf("NO");
				return;
			}
			reverse(all(p[j]));
		}
		if(p[0] == p[1] && p[1] == p[2] && p[2] == p[3])st[i] = 0;
		else if(p[0] == p[1] && p[2] == p[3])st[i] = 1;
		else if(p[0] == p[2] && p[1] == p[3])st[i] = 2;
		else if(p[0] == p[3] && p[1] == p[2])st[i] = 3;
		else st[i] = -1;
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		if(ans == -1 || st[i] == -1)ans = -1;
		else if(st[i] == 0)continue;
		else if(st[i] >= 1 && ans >= 1 && ans != st[i])ans = -1;
		else ans = st[i];
	}
	if(ans == -1)printf("NO");
	else printf("%s\n", ans == 0 ? "aaaa" : ans == 1 ? "aabb" : ans == 2 ? "abab" : "abba");
}

int main(){
	int Tc = 1;//; scanf("%d", &Tc);
	for(int tc=1; tc<=Tc; tc++){
		solve(tc);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int n, K;
int st[2520];

void solve(int tc){
	cin >> n >> K;
	string s[10010];
	for(int i=0;i<4*n;i++)cin >> s[i];
	for(int i=0;i<n;i++){
		string p[4];
		rep(j, 4){
			p[j] = "";
			int tk = K;
			for(int k=(int)s[4*i+j].length() - 1;k>=0;k--){
				char c = s[4*i+j][k];
				p[j].pb(c);
				if(c == 'i' || c == 'a' || c == 'e' || c == 'o' || c == 'u'){
					tk--;
					if(tk == 0)break;
				}
			}
			reverse(all(p[j]));
		}
		if(p[0] == p[1] && p[1] == p[2] && p[2] == p[3])st[i] = 0;
		else if(p[0] == p[1] && p[2] == p[3])st[i] = 1;
		else if(p[0] == p[2] && p[1] == p[3])st[i] = 2;
		else if(p[0] == p[3] && p[1] == p[2])st[i] = 3;
		else st[i] = -1;
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		if(ans == -1 || st[i] == -1)ans = -1;
		else if(st[i] == 0)continue;
		else if(st[i] >= 1 && ans >= 1 && ans != st[i])ans = -1;
		else ans = st[i];
	}
	if(ans == -1)printf("NO");
	else printf("%s\n", ans == 0 ? "aaaa" : ans == 1 ? "aabb" : ans == 2 ? "abab" : "abba");
}

int main(){
	int Tc = 1;//; scanf("%d", &Tc);
	for(int tc=1; tc<=Tc; tc++){
		solve(tc);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int n, K;
int st[2520];

void solve(int tc){
	cin >> n >> K;
	string s[10010];
	for(int i=0;i<4*n;i++)cin >> s[i];
	for(int i=0;i<n;i++){
		string p[4];
		rep(j, 4){
			p[j] = "";
			int tk = K;
			for(int k=(int)s[4*i+j].length() - 1;k>=0;k--){
				char c = s[4*i+j][k];
				p[j].pb(c);
				if(c == 'i' || c == 'a' || c == 'e' || c == 'o' || c == 'u'){
					tk--;
					if(tk == 0)break;
				}
			}
			reverse(all(p[j]));
		}
		if(p[0] == p[1] && p[1] == p[2] && p[2] == p[3])st[i] = 0;
		else if(p[0] == p[1] && p[2] == p[3])st[i] = 1;
		else if(p[0] == p[2] && p[1] == p[3])st[i] = 2;
		else if(p[0] == p[3] && p[1] == p[2])st[i] = 3;
		else st[i] = -1;
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		if(ans == -1 || st[i] == -1)ans = -1;
		else if(st[i] == 0)continue;
		else if(st[i] >= 1 && ans >= 1)ans = -1;
		else ans = st[i];
	}
	if(ans == -1)printf("NO");
	else printf("%s\n", ans == 0 ? "aaaa" : ans == 1 ? "aabb" : ans == 2 ? "abab" : "abba");
}

int main(){
	int Tc = 1;//; scanf("%d", &Tc);
	for(int tc=1; tc<=Tc; tc++){
		solve(tc);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int n, K;
int st[2520];

void solve(int tc){
	cin >> n >> K;
	string s[10010];
	for(int i=0;i<4*n;i++)cin >> s[i];
	for(int i=0;i<n;i++){
		string p[4];
		rep(j, 4){
			p[j] = "";
			int tk = K;
			for(int k=(int)s[4*i+j].length() - 1;k>=0;k--){
				char c = s[4*i+j][k];
				p[j].pb(c);
				if(c == 'i' || c == 'a' || c == 'e' || c == 'o' || c == 'u'){
					tk--;
					if(tk == 0)break;
				}
			}
			reverse(all(p[j]));
		}
		if(p[0] == p[1] && p[1] == p[2] && p[2] == p[3])st[i] = 0;
		else if(p[0] == p[1] && p[2] == p[3])st[i] = 1;
		else if(p[0] == p[2] && p[1] == p[3])st[i] = 2;
		else if(p[0] == p[3] && p[1] == p[2])st[i] = 3;
		else st[i] = -1;
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		if(st[i] == -1)ans = -1;
		else if(st[i] == 0)continue;
		else if(st[i] >= 1 && ans >= 1)ans = -1;
		else ans = st[i];
	}
	if(ans == -1)printf("NO");
	else printf("%s\n", ans == 0 ? "aaaa" : ans == 1 ? "aabb" : ans == 2 ? "abab" : "abba");
}

int main(){
	int Tc = 1;//; scanf("%d", &Tc);
	for(int tc=1; tc<=Tc; tc++){
		solve(tc);
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

int n, k;
int st[2520];

void solve(int tc){
	cin >> n >> k;
	string s[10010];
	for(int i=0;i<4*n;i++)cin >> s[i];
	for(int i=0;i<n;i++){
		string p[4];
		rep(j, 4){
			p[j] = "";
			for(int k=(int)s[4*i+j].length() - 1;k>=0;k--){
				char c = s[4*i+j][k];
				p[j].pb(c);
				if(c == 'i' || c == 'a' || c == 'e' || c == 'o' || c == 'u')break;
			}
			reverse(all(p[j]));
		}
		if(p[0] == p[1] && p[1] == p[2] && p[2] == p[3])st[i] = 0;
		else if(p[0] == p[1] && p[2] == p[3])st[i] = 1;
		else if(p[0] == p[2] && p[1] == p[3])st[i] = 2;
		else if(p[0] == p[3] && p[1] == p[2])st[i] = 3;
		else st[i] = -1;
	}
	int ans = 0;
	for(int i=0;i<n;i++){
		if(st[i] == -1)ans = -1;
		else if(st[i] == 0)continue;
		else if(st[i] >= 1 && ans >= 1)ans = -1;
		else ans = st[i];
	}
	if(ans == -1)printf("NO");
	else printf("%s\n", ans == 0 ? "aaaa" : ans == 1 ? "aabb" : ans == 2 ? "abab" : "abba");
}

int main(){
	int Tc = 1;//; scanf("%d", &Tc);
	for(int tc=1; tc<=Tc; tc++){
		solve(tc);
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <stdlib.h>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
//#include <unordered_set>
//#include <unordered_map>
//#include <sstream>
#include <set>
#include <map>
//#include <climits>
//#include <random>
//#include <deque>
using namespace std;

#define INF 2139062143
#define mem(a,v) memset(a,v,sizeof(a))
#define maxn 100005
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define red(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eps 1e-8
#define ll long long
#define mp make_pair
#define max(a,b) (a>b?a:b)
//#define min(a,b) (a<b?a:b)
typedef pair<int,int> pp;

string s[maxn];
set<char> uno = {'a', 'e', 'i', 'o', 'u'};
string getSuffix(string a,int k){
    int cnt = a.length()-1;
    red(j,a.length()-1,0)
    {
        if(uno.count(a[j]))
            k--;
        if(!k)
            break;
        cnt--;
    }
    if(k)
        return "NA";
    return a.substr(cnt,a.length()-cnt);
}
int main() {
    ios::sync_with_stdio(false);cout.setf(ios::fixed); cout.precision(20);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/input.txt", "r",stdin);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/train.txt", "r",stdin);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/output.txt", "w",stdout);
    int n,k;
    cin>>n>>k;
    vector<string> store;
    set<string> mys;
    rep(i,1,4*n)
        cin>>s[i];
    set<string> ans;
    for(int i=1;i<=4*n;i+=4)
    {
        store.clear();
        mys.clear();
        rep(j,0,3)
        {
            string tmp = getSuffix(s[i+j],k);
            if(tmp=="NA")
                return 0*puts("NO");
            store.pb(tmp),mys.insert(tmp);
        }
        if(mys.size()>2)
            return 0*puts("NO");
        else if(mys.size()==2)
        {
            if(store[0]==store[1] && store[2]==store[3])
                ans.insert("aabb");
            else if(store[0]==store[2] && store[1]==store[3])
                ans.insert("abab");
            else if(store[0]==store[3] && store[1]==store[2])
                ans.insert("abba");
        }
    }
    if(ans.size()==0)
        return 0*puts("aaaa");
    else if(ans.size()==1)
        cout<<*ans.begin()<<'\n';
    else
        puts("NO");

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <stdlib.h>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
//#include <unordered_set>
//#include <unordered_map>
//#include <sstream>
#include <set>
#include <map>
//#include <climits>
//#include <random>
//#include <deque>
using namespace std;

#define INF 2139062143
#define mem(a,v) memset(a,v,sizeof(a))
#define maxn 100005
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define red(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eps 1e-8
#define ll long long
#define mp make_pair
#define max(a,b) (a>b?a:b)
//#define min(a,b) (a<b?a:b)
typedef pair<int,int> pp;

string s[maxn];
set<char> uno = {'a', 'e', 'i', 'o', 'u'};
string getSuffix(string a,int k){
    int cnt = a.length()-1;
    red(j,a.length()-1,0)
    {
        if(uno.count(a[j]))
            k--;
        if(!k)
            break;
        cnt--;
    }
    if(k)
        return "NA";
    return a.substr(cnt,a.length()-cnt);
}
int main() {
    ios::sync_with_stdio(false);cout.setf(ios::fixed); cout.precision(20);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/input.txt", "r",stdin);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/train.txt", "r",stdin);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/output.txt", "w",stdout);
    int n,k;
    cin>>n>>k;
    vector<string> store;
    set<string> mys;
    rep(i,1,4*n)
        cin>>s[i];
    set<string> ans;
    for(int i=1;i<=4*n;i+=4)
    {
        store.clear();
        mys.clear();
        rep(j,0,3)
        {
            string tmp = getSuffix(s[i+j],k);
            if(tmp=="NA")
                return 0*puts("NO");
            store.pb(tmp),mys.insert(tmp);
        }
        if(mys.size()>2)
            return 0*puts("NO");
        else if(mys.size()==2)
        {
            if(store[0]==store[1] && store[2]==store[3])
                ans.insert("aabb");
            else if(store[0]==store[2] && store[1]==store[3])
                ans.insert("abab");
            else if(store[0]==store[3] && store[1]==store[2])
                ans.insert("abba");
            else
                return 0*puts("NO");
        }
    }
    if(ans.size()==0)
        return 0*puts("aaaa");
    else if(ans.size()==1)
        cout<<*ans.begin()<<'\n';
    else
        puts("NO");

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <stdlib.h>
#include <cstring>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
//#include <unordered_set>
//#include <unordered_map>
//#include <sstream>
#include <set>
#include <map>
//#include <climits>
//#include <random>
//#include <deque>
using namespace std;

#define INF 2139062143
#define mem(a,v) memset(a,v,sizeof(a))
#define maxn 100005
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define red(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eps 1e-8
#define ll long long
#define mp make_pair
#define max(a,b) (a>b?a:b)
//#define min(a,b) (a<b?a:b)
typedef pair<int,int> pp;

string s[maxn];
set<char> uno = {'a', 'e', 'i', 'o', 'u'};
string getSuffix(string a,int k){
    int cnt = a.length()-1;
    red(j,a.length()-1,0)
    {
        if(uno.count(a[j]))
            k--;
        if(!k)
            break;
        cnt--;
    }
    if(k)
        return "NA";
    return a.substr(cnt,a.length()-cnt);
}
int main() {
    ios::sync_with_stdio(false);cout.setf(ios::fixed); cout.precision(20);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/input.txt", "r",stdin);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/train.txt", "r",stdin);
//    freopen("/Users/huangqingwei/Documents/C++ workspace/codeforces/output.txt", "w",stdout);
    int n,k;
    cin>>n>>k;
    vector<string> store;
    set<string> mys;
    rep(i,1,4*n)
        cin>>s[i];
    set<string> ans;
    for(int i=1;i<=4*n;i+=4)
    {
        store.clear();
        rep(j,0,3)
        {
            string tmp = getSuffix(s[i+j],k);
            if(tmp=="NA")
                return 0*puts("NO");
            store.pb(tmp),mys.insert(tmp);
        }
        if(mys.size()>2)
            return 0*puts("NO");
        else if(mys.size()==2)
        {
            if(store[0]==store[1] && store[2]==store[3])
                ans.insert("aabb");
            else if(store[0]==store[2] && store[1]==store[3])
                ans.insert("abab");
            else if(store[0]==store[3] && store[1]==store[2])
                ans.insert("abba");
        }
    }
    if(ans.size()==0)
        return 0*puts("aaaa");
    else if(ans.size()==1)
        cout<<*ans.begin()<<'\n';
    else
        puts("NO");

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
string p[4]={"aaaa","aabb","abab","abba"};
string a[10000+10];
int main()
{
	int n,k;
	cin>>n>>k;
	n*=4;
	int bad=0;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		a[i]="";
		int t=0;
		while(t<k&&s.size())
		{
			char c=s[s.size()-1];
			a[i]+=c;
			s.erase(s.size()-1);
			if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
				t++;
		}
		if(t<k)
			bad=1;
	}
	if(!bad)
	{
		for(int i=0;i<4;i++)
		{
			int ok2=1;
			for(int j=0;j<n;j+=4)
			{
				int ok1=1;
				for(int x=0;x<4&&ok1;x++)
				{
					for(int y=x+1;y<4&&ok1;y++)
					{
						if(p[i][x]==p[i][y]&&a[j+x]!=a[j+y])
							ok1=0;
						if(!ok1)
						{
							ok2=0;
							break;
						}
					}
				}
			}
			if(ok2)
			{
				cout<<p[i];
				return 0;
			}
		}
	}
	cout<<"NO";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
string a[10005];
string p[4]={"aaaa","aabb","abab","abba"};
int main()
{
	int n,k,flag=0;
	cin>>n>>k;
	n*=4;
	for(int i=0;i<n;i++)
	{
		int cnt=0;
		string s;
		cin>>s;
		a[i]="";
		while(cnt<k&&s.size())
		{
			char x=s[s.size()-1];
			s.erase(s.size()-1);
			a[i]+=x;
			if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u')
				cnt++;
		}
		if(cnt<k)
			flag=1;
	}
	if(!flag)
	{
		for(int i=0;i<4;i++)
		{
			int ok2=1;
			for(int j=0;j<n;j+=4)
			{
				int ok1=1;
				for(int x=0;x<4&&ok1;x++)
				{
					for(int y=x+1;y<4&&ok1;y++)
					{
						if(p[i][x]==p[i][y]&&a[j+x]!=a[j+y])
							ok1=0;
						if(!ok1)
						{
							ok2=0;
							break;
						}
					}
				}
			}
			if(ok2)
			{
				cout<<p[i];
				return 0;
			}
		}
	}
	cout<<"NO";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,k,flag=0;
string a[10005];
string p[4]={"aaaa","aabb","abab","abba"};
int main()
{
	cin>>n>>k;
	n*=4;
	for(int i=0;i<n;i++)
	{
		int t=0;
		a[i]="";
		string s;
		cin>>s;
		while(t<k&&s.size())
		{
			char x=s[s.size()-1];
			a[i]+=x;
			s.erase(s.size()-1);
			if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u')
				t++;
		}
		if(t<k)
			flag=1;
	}
	if(!flag)
	{
		for(int i=0;i<4;i++)
		{
			int ok2=1;
			for(int j=0;j<n;j+=4)
			{
				int ok1=1;
				for(int x=0;x<4&&ok1;x++)
				{
					for(int y=x+1;y<4&&ok1;y++)
					{
						if(p[i][x]==p[i][y]&&a[j+x]!=a[j+y])
							ok1=0;
						if(!ok1)
						{
							ok2=0;
							break;
						}
					}
				}
			}
			if(ok2)
			{
				cout<<p[i];
				return 0;
			}
		}
	}
	cout<<"NO";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,k;
string a[10005];
string p[4]={"aaaa","aabb","abab","abba"};
int main()
{
	cin>>n>>k;
	bool flag=0;
	for(int i=0;i<n*4;i++)
	{
		int t=0;
		string s,ss;
		cin>>s;
		a[i]="";
		ss=s;
		reverse(ss.begin(),ss.end());
		while(t<k&&ss.size())
		{
			char x=ss[0];
			a[i]+=x;
			ss[0]='\0';
			if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u')
				t++;
		}
		if(t<k)
			flag=1;
	}
	if(!flag)
	{
		for(int i=0;i<4;i++)
		{
			bool ok2=true;
			for(int j=0;j<n*4;j+=4)
			{
				bool ok1=true;
				for(int x=0;x<4&&ok1;x++)
				{
					for(int y=x+1;y<4&&ok1;y++)
					{
						if(p[i][x]==p[i][y]&&a[j+x]!=a[j+y])
							ok1=false;
						if(!ok1)
						{
							ok2=false;
							break;
						}
					}
				}
			}
			if(ok2)
			{
				cout<<p[i];
				return 0;
			}
		}
	}
	cout<<"NO";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool a[1000];
string t[4];
int main()
{
	int n,k;
	cin>>n>>k;
	a['a']=a['e']=a['i']=a['o']=a['u']=true;
	set<string>sum;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<4;j++)
		{
			string s;
			cin>>s;
			int p=s.size();
			int c=0;
			while(p>0&&c<k)
			{
				p--;
				if(a[s[p]])
					c++;
			}
			if(c<k)
			{
				cout<<"NO";
				return 0;
			}
			t[j]=s.substr(p);
		}
		if(t[0]==t[1])
		{
			if(t[2]==t[3])
			{
				if(t[1]==t[2])
					sum.insert("aaaa");
				else
					sum.insert("aabb");
			}
			else
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			if(t[0]==t[2])
			{
				if(t[1]==t[3])
					sum.insert("abab");
				else
				{
					cout<<"NO";
					return 0;
				}
			}
			else
			{
				if(t[0]==t[3]&&t[1]==t[2])
					sum.insert("abba");
				else
				{
					cout<<"NO";
					return 0;
				}
			}
		}
	}
	if(sum.size()>1)
	{
		if(sum.size()==2&&*sum.begin()=="aaaa")
			sum.erase(sum.begin());
		else
		{
			cout<<"NO";
			return 0;
		}
	}
	if(sum.size()<1)
		return 0;
	cout<<*sum.begin();

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
string a[10005];
string p[4]={"aaaa","aabb","abab","abba"};
int main()
{
	int n,k,flag=0;
	cin>>n>>k;
	n*=4;
	for(int i=0;i<n;i++)
	{
		int cnt=0;
		string s;
		cin>>s;
		a[i]="";
		while(cnt<k&&s.size())
		{
			char x=s[s.size()-1];
			a[i]+=x;
			s.erase(s.size()-1);
			if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u')
				cnt++;
		}
		if(cnt<k)
			flag=1;
	}
	if(!flag)
	{
		for(int i=0;i<4;i++)
		{
			int ok2=1;
			for(int j=0;j<n;j+=4)
			{
				int ok1=1;
				for(int x=0;x<4&&ok1;x++)
				{
					for(int y=x+1;y<4&&ok1;y++)
					{
						if(p[i][x]==p[i][y]&&a[j+x]!=a[j+y])
							ok1=0;
					}
				}
				if(!ok1)
				{
					ok2=0;
					break;
				}
			}
			if(ok2)
			{
				cout<<p[i];
				return 0;
			}
		}
	}
	cout<<"NO";

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
string a[10005];
char s[10005];
int main()
{
	int n,k;
	cin>>n>>k;
	n*=4;
	for(int i=0;i<n;i++)
	{
		int cnt=0;
		cin>>s;
		for(int j=strlen(s)-1;j>=0;j--)
		{
			if(s[j]=='a'||s[j]=='e'||s[j]=='i'||s[j]=='o'||s[j]=='u')
				cnt++;
			if(cnt==k)
			{
        		a[i]=string(s+j);
				break;
			}
		}
		if(a[i].size()==0)
			a[i]+='0'+(i%4);
	}
	bool aabb=1,abab=1,abba=1;
	for(int i=0;i<n;i+=4)
	{
		aabb&=(a[i]==a[i+1])and(a[i+2]==a[i+3]);
		abab&=(a[i]==a[i+2])and(a[i+1]==a[i+3]);
		abba&=(a[i]==a[i+3])and(a[i+1]==a[i+2]);
	}
	if(aabb&&abab&&abba)
		cout<<"aaaa";
	else if(aabb)
		cout<<"aabb";
	else if(abab)
		cout<<"abab";
	else if(abba)
		cout<<"abba";
	else
		cout<<"NO";

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,k;bool aaaa,aabb,abab,abba;
inline bool isyuan(char c){return (c=='a'||c=='o'||c=='e'||c=='i'||c=='u');}
string Type(vector<string>v)
{
	if(v.size()<4||v[0]=="NO"||v[1]=="NO"||v[2]=="NO"||v[3]=="NO")return "NO";
	if(v[0]==v[1]&&v[2]==v[3]&&v[0]==v[2])return "aaaa";
	if(v[0]==v[1]&&v[2]==v[3])return "aabb";
	if(v[0]==v[2]&&v[1]==v[3])return "abab";
	if(v[0]==v[3]&&v[1]==v[2])return "abba";
	return "NO";
}
void change(string &s)
{
	string t="";
	int cnt=0;
	for(int i=s.size()-1;i>=0;i--)
	{
		t+=s[i];
		if(isyuan(s[i]))cnt++;
		if(cnt==k)break;
	}
	if(cnt<k)t="NO";
	else reverse(t.begin(),t.end());
	s=t;
}
void solve()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		vector<string>v;
		v.clear();
		for(int j=0;j<4;j++)
		{
			string s;
			cin>>s;
			change(s);
			v.push_back(s);
		}
		string s=Type(v);
		if(s=="NO")
		{
			puts("NO");
			return;
		}
		if(s=="aaaa")aaaa=true;
		if(s=="abab")abab=true;
		if(s=="abba")abba=true;
		if(s=="aabb")aabb=true;
	}
	if(abab+abba+aabb>=2)puts("NO");
	else if(aaaa+abab+abba+aabb==0)puts("NO");
	else{
		if(abab)puts("abab");
		else if(abba)puts("abba");
		else if(aabb)puts("aabb");
		else if(aaaa)puts("aaaa");
	}
	return;
}
int main()
{
	solve();
	return 0;
}


// luogu-judger-enable-o2
#include <bits/stdc++.h>
using namespace std;
const string tp[4]={"aaaa","aabb","abab","abba"};
const int N=1e4+10;
int n,k;
string w[N];
int main() {
    cin>>n>>k;
    n*=4;
    int bad=0;
    for(int i=0;i<n;i++) {
        string s;
        cin>>s;
        w[i]="";
        int l=0;
        while(l<k && s.size()) {
            char c=s[s.size()-1];
            w[i]+=c;
            s.erase(s.size()-1);
            if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u') l++;
        }
        if(l<k) bad=1;
    }
    if(!bad) {
        for(int t=0;t<4;t++) {
            int ok2=1;
            for(int i=0;i<n;i+=4) {
                int ok=1;
                for(int p=0;p<4 && ok;p++) {
                    for(int q=p+1;q<4 && ok; q++) {
                        if(tp[t][p]==tp[t][q] && w[i+p]!=w[i+q]) {
                            ok=0;
                        }
                    }
                }
                if(!ok) {
                    ok2=0;
                    break;
                }
            }
            if(ok2) {
                cout<<tp[t]<<endl;
          //      system("pause");
                return 0;
            }
        }
    }
    cout<<"NO"<<endl;
 //   system("pause");
    return 0;
}


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

map<char, bool> mp;

string last(string s, int k){
	for(int i=s.size()-1; i>=0; i--){
		if(k==0) return s.substr(i+2);
		if(mp[s[i]]) k--;
	}
	return s;
}

string judge(string s1, string s2, string s3, string s4){
	if(s1==s2 && s2==s3 && s3==s4) return "aaaa";
	if(s1==s2 && s3==s4 && s2!=s3) return "aabb";
	if(s1==s4 && s2==s3 && s1!=s2) return "abba";
	if(s1==s3 && s2==s4 && s1!=s2) return "abab";
	else return "WRONG";
}

int main(){
	int n, k;
	vector<string> ans;
	mp['a'] = mp['e'] = mp['i'] = mp['o'] = mp['u'] = true;
	cin >> n >> k;
	string s1, s2, s3, s4;
	for(int i=0; i<n; i++){
		cin >> s1 >> s2 >> s3 >> s4;
		s1 = last(s1, k);
		s2 = last(s2, k);
		s3 = last(s3, k);
		s4 = last(s4, k);
		string p=judge(s1, s2, s3, s4);
		if(p=="WRONG"){
			cout << "NO";
			return 0;
		}
		ans.push_back(p);
	}
	string total="";
	for(int i=1; i<ans.size(); i++){
		if(ans[i]!=ans[i-1]){
			if(ans[i]!="aaaa" && ans[i-1]!="aaaa"){
				cout << "NO";
				return 0;
			}
			else if(ans[i]=="aaaa") total = ans[i-1];
			else total = ans[i];
		}
	}
	if(total=="") total = ans[0];
	cout << total;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxl=4;
set<string> res;
int n,k;
string suf[4];
bool syll[128];
void nope(){
    cout<<"NO\n";
    exit(0);
}
int main(){
    syll['a']=syll['e']=syll['i']=syll['o']=syll['u']=true;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<maxl;j++){
            string str;
            cin>>str;
            int p=str.size(),c=0;
            while(c<k&&p>0){
                p--;
                if(syll[str[p]])c++;
            }
            if(c<k)nope();
            suf[j]=str.substr(p);
        }
        if(suf[0]==suf[1]){
            if(suf[2]==suf[3]){
                if(suf[2]==suf[3])res.insert("aaaa");
                else res.insert("aabb");
            }else nope();
        }else if(suf[0]==suf[2]){
            if(suf[1]==suf[3]){
                res.insert("abab");
            }
        }else if(suf[0]==suf[3]&&suf[1]==suf[2]){
            res.insert("abba");
        }else nope();
    }
    if(res.size()>1){
        if(res.size()==2&&*res.begin()=="aaaa")res.erase(res.begin());
        else nope();
    }
    cout<<*res.begin()<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main (){
	cout<<"aaaa";
	return 0;
}


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

#define forn(i, n) for(int i=0; i<(n); ++i)
#define forv(i, v) forn(i, (int)(v).size())
#define inf 1000000000
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define lng long long
#define eps 1e-8
#define SQ(a) ((a)*(a))
#define PI 3.14159265359
#define index asdindex

bool syll[256];

void nope(){
	cout << "NO";
	exit(0);
}

int main(){
	syll['a']=syll['e']=syll['i']=syll['o']=syll['u']=true;
	int n, k;
	cin >> n >> k;
	set<string> res;
	forn(i, n){
		string suf[4];
		forn(j, 4){
			string s;
			cin >> s;
			int p=s.length();
			int c=0;
			while(p>0 && c<k){
				--p;
				if(syll[s[p]]) ++c;
			}
			if(c<k) nope();
			suf[j] = s.substr(p);
		}
		if(suf[0]==suf[1]){
			if(suf[2]==suf[3]){
				if(suf[1]==suf[2]) res.insert("aaaa");
			    else
			       res.insert("aabb");
			}else nope();
		}
		else if(suf[0]==suf[2]){
			if(suf[1]==suf[3]) res.insert("abab");
			else nope();
		}else if(suf[0]==suf[3] && suf[1]==suf[2]) res.insert("abba");
		else nope();
	}
	if(res.size()>1){
		if(res.size()==2 && *res.begin()=="aaaa") res.erase(res.begin());
		else nope();
	}
	if(res.size()<1) exit(321);
	cout << *res.begin();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,k;bool aaaa,abab,abba;
string s[5];bool aabb;
inline bool isyuan(char c){return (c=='a'||c=='o'||c=='e'||c=='i'||c=='u');}
void change(string &t)
{
	string r="";
	int cnt=0;
	for(int i=t.size()-1;i>=0;i--)
	{
		r+=t[i];
		if(isyuan(t[i]))cnt++;
		if(cnt==k)break;
	}
	if(cnt!=k)
	{
		puts("NO");
		exit(0);
	}
	reverse(r.begin(),r.end());
	t=r;
}
void solve()
{
	if(s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3])
	{
		aaaa=true;
		return;
	}
	if(s[0]==s[1]&&s[2]==s[3])aabb=true;
	else if(s[0]==s[2]&&s[1]==s[3])abab=true;
	else if(s[0]==s[3]&&s[1]==s[2])abba=true;
	else{
		puts("NO");
		exit(0);
	}
}
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<4;j++)
		{
			cin>>s[j];
			change(s[j]);
		}
		solve();
	}
	if(abab+abba+aabb>1)puts("NO");
	else if(abab+abba+aabb==0&&!aaaa)puts("NO");
	else{
		if(abab)puts("abab");
		else if(abba)puts("abba");
		else if(aabb)puts("aabb");
		else if(aaaa)puts("aaaa");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const char al[]={'a', 'e', 'i', 'o', 'u'};

int aabb, abab, abba, aaaa, sum, n, js, num, a;
string c[10010];
string s;
inline int check(char c)
{
	for (int i = 0; i < 6; ++i) if (al[i] == c) return 1;
	return 0;
}
inline int check2()
{
	string s = c[1];
	for (int i = 2; i <= 4; ++i) if (s != c[i]) return 0;
	return 1;
}
int main()
{
	cin >> n >> a;
	//getchar();
	for (int i = 1; i <= n; ++i){
		//aabb = 0; abab = 0; abba = 0;
		for (int j = 1; j <= 4; ++j){
			num = 0;
			cin >> s;
			int len = s.size();
			for (int k = len - 1; k >= 0; --k){
				if (check(s[k]))num++;
				if (num == a){
					c[j] = s.substr(k);
					break;
				}
			}
		}
		if (check2()&& !aaaa)aaaa = 1, js++;
		if (c[1] == c[2] && c[3] == c[4] && c[1] != c[3] && !aabb)aabb = 1, js++;
		if (c[1] == c[4] && c[2] == c[3] && c[1] != c[2] && !abba)abba = 1, js++;
		if (c[1] == c[3] && c[2] == c[4] && c[1] != c[2] && !abab)abab = 1, js++;
	}
	if (js == 1){
		if (aabb) puts("aabb"); if (aaaa) puts("aaaa"); if(abab) puts("abab"); if(abba) puts("abba");
	}
	else if (aaaa && aabb)puts("aaaa");
	else puts("NO");
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
using namespace std;

int n,k;
string ans="aaaa";

int main(void){
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++){
		vector <string> ss;
		for(int j=1;j<=4;j++){
			string s;
			cin>>s;
			int sum=0;
			for(int p=s.length()-1;p>=0;p--){
				if(strchr("aeiou",s[p])!=NULL)sum++;
				if(sum>=k){
					ss.push_back(s.substr(p));
					break;
				}
			}
		}
		string tmp;
		if(ss.size()<4){
			tmp="NO";
		}
		else
		if(ss[0]==ss[1]&&ss[1]==ss[2]&&ss[2]==ss[3])
		tmp="aaaa";
		else
		if(ss[0]==ss[1]&&ss[2]==ss[3])
		tmp="aabb";
		else
		if(ss[0]==ss[2]&&ss[1]==ss[3])
		tmp="abab";
		else
		if(ss[0]==ss[3]&&ss[1]==ss[2])
		tmp="abba";
		else tmp="NO";
		if(ans=="aaaa")ans=tmp;
		else
		if(ans==tmp||tmp=="aaaa");
		else
		ans="NO";
	}
	cout<<ans;
}


// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
bool syll[256];
void hope(){
	cout<<"NO";
	exit(0);
}
int main(){
	int n,k;
	cin>>n>>k;
	set<string> res;
	for(int i=0;i<n;i++){
		string suf[4];
		for(int j=0;j<4;j++){
			string s;
			cin>>s;
			int p=s.size();
			int c=0;
			while(p>0&&c<k){
				p--;
				if(syll[s[p]]) c++;
			}
			if(c<k) nope();
			suf[j]=s.substr(p);
		}
		if(suf[0]==suf[1]){
			if(suf[2]==suf[3]){
				if(suf[1]==suf[2]){
					res.insert("aaaa");
				}
				else
					res.insert("aabb");
			}else nope();
		}
		else if(suf[0]==suf[2]){
			if(suf[1]==suf[3])
				res.insert("abab");
			else nope();
		}
		else if(suf[0]==suf[3]&&suf[1]==suf[2])
		   res.insert("abba");
		else nope();
	}
	if(res.size()>1){
		if(res.size()==2&&*res.begin()=="aaaa"){
			res.erase(res.begin());
		}else nope();
	}
	if(res.size()<1){
		exit(321);
	}
	cout<<*ers.begin();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxl=4;
set<string> res;
int n,k;
string suf[4];
bool syll[128];
void nope(){
    cout<<"NO\n";
    exit(0);
}
int main(){
    // freopen("testdata.in","r",stdin);
    syll['a']=syll['e']=syll['i']=syll['o']=syll['u']=true;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<maxl;j++){
            string str;
            cin>>str;
            int p=str.size(),c=0;
            while(c<k&&p>0){
                p--;
                if(syll[str[p]])c++;
            }
            if(c<k)nope();
            suf[j]=str.substr(p);
        }
        if(suf[0]==suf[1]){
            if(suf[2]==suf[3]){
                if(suf[1]==suf[2])res.insert("aaaa");
                else res.insert("aabb");
            }else nope();
        }else if(suf[0]==suf[2]){
            if(suf[1]==suf[3]){
                res.insert("abab");
            }else nope();
        }else if(suf[0]==suf[3]&&suf[1]==suf[2]){
            res.insert("abba");
        }else nope();
    }
    if(res.size()>1){
        if(res.size()==2&&*res.begin()=="aaaa")res.erase(res.begin());
        else nope();
    }
    cout<<*res.begin()<<endl;
    return 0;
}


// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int main (){
	cout<<"abab";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const string tp[4]={"aaaa","aabb","abab","abba"};
string w[10000];
int n,m,k;
int main(){
    cin>>n>>k;
    n*=4;
    int bad=0;
    for(int i=0;i<n;i++){
        string s;cin>>s;
        w[i]="";
        int l=0;
        while(l<k&&s.size()){
            char c=s[s.size()-1];
            w[i]+=c;
            s.erase(s.size()-1);
            if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')l++;
        }
        if(l<k)bad=1;
    }
    if(!bad){
        for(int t=0;t<4;t++){
            int ok2=1;
            for(int i=0;i<n;i+=4){
                int ok=1;
                for(int p=0;p<4&&ok;p++){
                    for(int q=p+1;q<4&&ok;q++){
                        if(tp[t][p]==tp[t][q]&&w[i+p]!=w[i+q])ok=0;
                    }
                }
                if(!ok){ok2=0;break;}
            }
            if(ok2){
                cout<<tp[t]<<endl;
                return 0;
            }
        }
    }
    cout<<"NO"<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const string tp[4]={"aaaa","aabb","abab","abba"};
int n;
int m,k;
string w[10000];
int main()
{
	cin>>n>>k;
	n*=4;
	int bad=0;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		w[i]="";
		int l=0;
		while(l<k&&s.size())
		{
			char c=s[s.size()-1];
			w[i]+=c;
			s.erase(s.size()-1);
			if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
			l++;
		}
		if(l<k)
		bad=1;
	}
	if(!bad)
	for(int t=0;t<4;t++)
	{
		int ok2=1;
		for(int i=0;i<n;i+=4)
		{
			int ok=1;
			for(int p=0;p<4&&ok;p++)
			for(int q=p+1;q<4&&ok;q++)
			if(tp[t][p]==tp[t][q]&&w[i+p]!=w[i+q])
			ok=0;
			if(!ok)
			{
				ok2=0;
				break;
			}
		}
		if(ok2)
		{
			cout<<tp[t]<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const string tp[4]={"aaaa","aabb","abab","abba"};
int n;
int m,k;
string w[10000];
int main()
{
	cin>>n>>k;
	n*=4;
	int bad=0;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		w[i]="";
		int l=0;
		while(l<k&&s.size())
		{
			char c=s[s.size()-1];
			w[i]+=c;
			s.erase(s.size()-1);
			if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
			l++;
		}
		if(l<k)
		bad=1;
	}
	if(!bad)
	for(int t=0;t<4;t++)
	{
		int ok2=1;
		for(int i=0;i<n;i+=4)
		{
			int ok=1;
			for(int p=0;p<4&&ok;p++)
			for(int q=p+1;q<4&&ok;q++)
			if(tp[t][p]==tp[t][q]&&w[i+p]!=w[i+q])
			ok=0;
			if(!ok)
			{
				ok2=0;
				break;
			}
		}
		if(ok2)
		{
			cout<<tp[t]<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
#include <set>
#include <string>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>

using namespace std;

const int N = 500100;
const double EPS = 0.0001;
const long long MOD = 1e9 + 7;
const long long P = 57;

int i, j, n, m, k, a[N], b[N];
map <int, int> M, S;

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m;
    k = 0;
    for (i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    int ans = 0;
    int kk = n / m, f = 0;
    for (i = 0; i < n; i ++)
    {
        for (j = 1; j <= m; j ++)
            b[j] = 0;
        for (j = 0; j < n; j ++)
            if (a[j] <= m)
                b[a[j]] ++;
        int k = 1;
        for (j = 2; j <= m; j ++)
            if (b[k] > b[j])
                k = j;
        if (kk == b[k])
        {
            f = 1;
            break;
        }
        for (j = 0; j < n; j ++)
            if (a[j] > m)
        {
            ans ++;
            a[j] = k;
            break;
        }
    }
    for (i = 0; i < n; i ++)
    {
        if (f == 1)
            break;
        for (j = 1; j <= m; j ++)
            b[j] = 0;
        for (j = 0; j < n; j ++)
            b[a[j]] ++;
        int k1 = 1;
        for (j = 2; j <= m; j ++)
            if (b[k1] < b[j])
                k1 = j;
            int l = 0;
        for (j = 0; j < n; j ++)
            if (b[a[j]] == b[k1])
                l = j;
        int k = 0;
        for (j = 1; j <= m; j ++)
            if (b[j] < kk)
                k = j;
            if (k == 0)
                break;
        for (j = 0; j < n; j ++)
            if (b[a[j]] == b[a[l]])
        {
            ans ++;
            a[l] = k;
            break;
        }
    }
    for (i = 1; i <= m; i ++)
        b[i] = 0;
    for (i = 0; i < n; i ++)
        if (a[i] <= m)
            b[a[i]] ++;
    k = 20000000;
    for (i = 1; i <= m; i ++)
        k = min(k, b[i]);
    cout << k << " " << ans << endl;
    for (i = 0; i < n; i ++)
        cout << a[i] << " ";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
#include <set>
#include <string>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cstring>

using namespace std;

const int N = 500100;
const double EPS = 0.0001;
const long long MOD = 1e9 + 7;
const long long P = 57;

int i, j, n, m, k, a[N], b[N];
map <int, int> M, S;

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m;
    k = 0;
    for (i = 0; i < n; i ++)
    {
        cin >> a[i];
    }
    int ans = 0;
    int kk = n / m, f = 0;
    for (i = 0; i < n; i ++)
    {
        for (j = 1; j <= m; j ++)
            b[j] = 0;
        for (j = 0; j < n; j ++)
            if (a[j] <= m)
                b[a[j]] ++;
        int k = 1;
        for (j = 2; j <= m; j ++)
            if (b[k] > b[j])
                k = j;
        if (kk == b[k])
        {
            f = 1;
            break;
        }
        for (j = 0; j < n; j ++)
            if (a[j] > m)
        {
            ans ++;
            a[j] = k;
            break;
        }
    }
    for (i = 0; i < n; i ++)
    {
        if (f == 1)
            break;
        for (j = 1; j <= m; j ++)
            b[j] = 0;
        for (j = 0; j < n; j ++)
            b[a[j]] ++;
        int k1 = 1;
        for (j = 2; j <= m; j ++)
            if (b[k1] < b[j])
                k1 = j;
            int l = 0;
        for (j = 0; j < n; j ++)
            if (b[a[j]] == b[k1])
                l = j;
        int k = 0;
        for (j = 1; j <= m; j ++)
            if (b[j] < kk)
                k = j;
            if (k == 0)
                break;
        for (j = 0; j < n; j ++)
            if (b[a[j]] < kk)
        {
            ans ++;
            a[l] = k;
            break;
        }
    }
    for (i = 1; i <= m; i ++)
        b[i] = 0;
    for (i = 0; i < n; i ++)
        if (b[a[i]] <= m)
            b[a[i]] ++;
    k = 20000000;
    for (i = 1; i <= m; i ++)
        k = min(k, b[i]);
    cout << k << " " << ans << endl;
    for (i = 0; i < n; i ++)
        cout << a[i] << " ";
    return 0;
}

/*
*/


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
int aw=0;
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	while(flag[i]<fw){
        while(!Vc.empty()){int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){flag[b[x]]--;b[x]=i;flag[i]++;break;}
        }
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
int aw=0;
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	if(flag[i]<fw){
        while(!Vc.empty()){int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){flag[b[x]]--;b[x]=i;flag[i]++;break;}
        }
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;t=n-fw*m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
int aw=0;
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	if(flag[i]<fw){
        int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){b[x]=i;flag[i]++;flag[b[x]]--;}
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		if(sw>=n/m)continue;
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	while(flag[i]<fw){
        while(!Vc.empty()){int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){flag[b[x]]--;b[x]=i;flag[i]++;break;}
        }
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		if(sw<=n/m)continue;
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	while(flag[i]<fw){
        while(!Vc.empty()){int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){flag[b[x]]--;b[x]=i;flag[i]++;break;}
        }
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
int aw=0;
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	if(flag[i]<fw){
        while(!Vc.empty()){int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){b[x]=i;flag[i]++;flag[b[x]]--;break;}
        }
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		if(sw>=n/m)continue;
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
int fk=0;
for(register int i=1;i<=m;i++)if(flag[i]<n/m)fk=1;
if(fk==0){
	int diff=0;
	for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
	printf("%d %d\n",n/m,diff);
	for(register int i=1;i<=n;i++)printf("%d ",b[i]);
	putchar('\n');
	return 0;
}
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	while(flag[i]<fw){
        while(!Vc.empty()){int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){flag[b[x]]--;b[x]=i;flag[i]++;break;}
        }
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;

const int N=2005,INF=1000000000;

int n,m,b[N],a[N],flag[N],t,ans=INF;
vector<int> Vc;

int main(){
//freopen("C.in","r",stdin);
//freopen("C.out","w",stdout);
scanf("%d %d",&n,&m);
int fw=n/m;
for(register int i=1;i<=n;i++){scanf("%d",&b[i]);a[i]=b[i];if(b[i]<=m)flag[b[i]]++;}
for(register int i=1;i<=n;i++){
	if(b[i]>m || flag[b[i]]>fw+1){
		int sw=INF,sk=0;
		for(register int j=1;j<=m;j++){
			if(sw>flag[j]){sw=flag[j];sk=j;}
		}
		flag[sk]++;
		if(b[i]<=m)flag[b[i]]--;
		b[i]=sk;
	}
}
for(register int i=1;i<=n;i++)if(flag[b[i]]==fw+1)Vc.push_back(i);
for(register int i=1;i<=m;i++){
	while(flag[i]<fw){
        while(!Vc.empty()){int x=Vc.back();Vc.pop_back();
        if(flag[b[x]]==fw+1){flag[b[x]]--;b[x]=i;flag[i]++;break;}
        }
	}
}
int diff=0;
for(int i=1;i<=n;i++)if(a[i]!=b[i])diff++;
printf("%d %d\n",n/m,diff);
for(register int i=1;i<=n;i++)printf("%d ",b[i]);
putchar('\n');
return 0;
}