#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
int n;
int m;
int k;
string s[4];
string ans[2500];
bool rhyme(string s, string t, int k) {
  int cur = ((int)(s).size()) - 1;
  int m = k;
  while (cur >= 0) {
    if (s[cur] == 'a' || s[cur] == 'o' || s[cur] == 'e' || s[cur] == 'i' ||
        s[cur] == 'u')
      m--;
    if (m == 0) break;
    cur--;
  }
  if (cur < 0) return false;
  string ss = "";
  for (int i = cur; i < ((int)(s).size()); i++) ss += s[i];
  cur = ((int)(t).size()) - 1;
  m = k;
  while (cur >= 0) {
    if (t[cur] == 'a' || t[cur] == 'o' || t[cur] == 'e' || t[cur] == 'i' ||
        t[cur] == 'u')
      m--;
    if (m == 0) break;
    cur--;
  }
  if (cur < 0) return false;
  string tt = "";
  for (int i = cur; i < ((int)(t).size()); i++) tt += t[i];
  return ss == tt;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (4); j++) cin >> s[j];
    if (rhyme(s[0], s[1], k) && rhyme(s[0], s[2], k) && rhyme(s[0], s[3], k))
      ans[i] = "aaaa";
    else {
      if (rhyme(s[0], s[1], k) && rhyme(s[2], s[3], k))
        ans[i] = "aabb";
      else if (rhyme(s[0], s[2], k) && rhyme(s[1], s[3], k))
        ans[i] = "abab";
      else if (rhyme(s[0], s[3], k) && rhyme(s[1], s[2], k))
        ans[i] = "abba";
      else
        ans[i] = "NO";
    }
  }
  string Ans = ans[0];
  for (int i = 0; i < (n); i++) {
    if (ans[i] == "NO") {
      cout << "NO" << endl;
      return 0;
    }
    if (ans[i] != Ans) {
      if (Ans == "aaaa")
        Ans = ans[i];
      else if (ans[i] != "aaaa") {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << Ans << endl;
  return 0;
}
