#include <bits/stdc++.h>
using namespace std;
static char vowels[] = {'a', 'e', 'i', 'o', 'u'};
struct Quatrain {
  string lines[4];
  set<string> rhymes;
  int getVowels(int i, int k) {
    int j;
    for (j = lines[i].length() - 1; j >= 0; j--) {
      int u;
      for (u = 0; u < 5; u++) {
        if (lines[i][j] == vowels[u]) {
          break;
        }
      }
      if (u < 5) {
        k--;
        if (k <= 0) {
          break;
        }
      }
    }
    if (j >= 0) return j;
    return -1;
  }
  bool checkRhyme(int i, int j, int k) {
    int l = getVowels(i, k);
    if (l == -1) return false;
    int m = getVowels(j, k);
    if (m == -1) return false;
    if (lines[i].length() - l != lines[j].length() - m) return false;
    for (size_t n = l, u = m; n < lines[i].length(); n++, u++)
      if (lines[i][n] != lines[j][u]) return false;
    return true;
  }
  bool checkAABB(int k) {
    if (checkRhyme(0, 1, k) && checkRhyme(2, 3, k)) return true;
    return false;
  }
  bool checkABAB(int k) {
    if (checkRhyme(0, 2, k) && checkRhyme(1, 3, k)) return true;
    return false;
  }
  bool checkABBA(int k) {
    if (checkRhyme(0, 3, k) && checkRhyme(1, 2, k)) return true;
    return false;
  }
  bool checkAAAA(int k) {
    if (checkRhyme(0, 1, k) && checkRhyme(1, 2, k) && checkRhyme(2, 3, k))
      return true;
    return false;
  }
  void calc(int K) {
    if (checkAAAA(K)) {
      rhymes.insert("aaaa");
    }
    if (checkAABB(K)) {
      rhymes.insert("aabb");
    }
    if (checkABAB(K)) {
      rhymes.insert("abab");
    }
    if (checkABBA(K)) {
      rhymes.insert("abba");
    }
  }
};
int main(int argc, char *argv[]) {
  int N, K;
  cin >> N >> K;
  Quatrain q[N];
  int i;
  for (i = 0; i < N; i++) {
    for (int j = 0; j < 4; j++) cin >> q[i].lines[j];
    q[i].calc(K);
    if (q[i].rhymes.size() == 0) {
      cout << "NO" << std::endl;
      return 0;
    }
  }
  string rhymes[] = {"aaaa", "aabb", "abab", "abba"};
  string ret = "";
  for (size_t i = 0; i < 4; i++) {
    int j;
    for (j = 0; j < N; j++) {
      set<string>::iterator it = q[j].rhymes.find(rhymes[i]);
      if (it == q[j].rhymes.end()) break;
    }
    if (j >= N) {
      ret = rhymes[i];
      break;
    }
  }
  if (ret == "")
    cout << "NO" << endl;
  else
    cout << ret << endl;
  return 0;
}
