#include <bits/stdc++.h>
using namespace std;
int getInd(string s, int k) {
  for (int i = s.size() - 1; k && i >= 0; i--) {
    if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' ||
        s[i] == 'u') {
      k--;
      if (k == 0) return i;
    }
  }
  return -1;
}
bool equals(string s1, string s2, int in1, int in2) {
  if (s1.size() - in1 != s2.size() - in2) return false;
  for (int i = in1, j = in2; i < s1.size() && j < s2.size(); i++, j++)
    if (s1[i] != s2[j]) return false;
  return true;
}
bool analyse(string &ry, string s[4], int k) {
  string tmp = "a";
  int a = getInd(s[0], k), b = getInd(s[1], k), c = getInd(s[2], k),
      d = getInd(s[3], k);
  if (a == -1 || b == -1 || c == -1 || d == -1) return false;
  if (equals(s[0], s[1], a, b))
    tmp = tmp + 'a';
  else
    tmp = tmp + 'b';
  if (equals(s[1], s[2], b, c))
    tmp = tmp + tmp[1];
  else if (equals(s[0], s[2], a, c))
    tmp = tmp + tmp[0];
  else if (equals(tmp, "aa", 0, 0))
    tmp = tmp = tmp + 'b';
  else
    return 0;
  if (equals(s[0], s[3], a, d))
    tmp = tmp + tmp[0];
  else if (equals(s[1], s[3], b, d))
    tmp = tmp + tmp[1];
  else if (equals(s[2], s[3], c, d))
    tmp = tmp + tmp[2];
  else
    return false;
  if (ry.size() > 0) {
    if (equals(tmp, ry, 0, 0) || equals(tmp, "aaaa", 0, 0))
      return true;
    else if (equals(ry, "aaaa", 0, 0)) {
      ry = tmp;
      return true;
    } else
      return false;
  }
  if (equals(tmp, "aaaa", 0, 0) || equals(tmp, "abab", 0, 0) ||
      equals(tmp, "aabb", 0, 0) || equals(tmp, "abba", 0, 0)) {
    ry = tmp;
    return true;
  } else
    return false;
}
int main(void) {
  int n, k;
  cin >> n >> k;
  string s[n + 1][4];
  string rym = "";
  bool mark = true;
  for (int i = 0; i < n; i++) {
    cin >> s[i][0];
    cin >> s[i][1];
    cin >> s[i][2];
    cin >> s[i][3];
    if (mark) {
      mark = analyse(rym, s[i], k);
    }
  }
  if (mark)
    cout << rym;
  else
    cout << "NO";
  return 0;
}
