#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
string a[100];
char ans[4], z[4];
int check(string second) {
  if (second == "abba")
    return 0;
  else if (second == "abab")
    return 1;
  else if (second == "aabb")
    return 2;
  else if (second == "aaaa")
    return 3;
  else
    return -1;
}
int main() {
  cin >> n >> k;
  for (int t = 0; t < n; t++) {
    int q = 0;
    for (int i = 0; i < 4; i++) {
      string second;
      cin >> second;
      int x = k, j = second.length() - 1;
      a[i] = "";
      while (x > 0 && j >= 0) {
        a[i] = second[j] + a[i];
        if (second[j] == 'a' || second[j] == 'e' || second[j] == 'i' ||
            second[j] == 'o' || second[j] == 'u')
          x--;
        j--;
      }
      if (x > 0) a[i] = char(i + 48) + "";
      if (i == 0)
        z[i] = char(q + 97);
      else {
        bool ok = false;
        for (int p = 0; p < i; p++)
          if (a[i] == a[p]) {
            ok = true;
            z[i] = z[p];
            break;
          }
        if (!ok) {
          q++;
          z[i] = char(q + 97);
        }
      }
    }
    string zz = "", aa = "";
    for (int w = 0; w < 4; w++) {
      zz = zz + z[w];
      aa = aa + ans[w];
    }
    if (check(zz) == -1) {
      cout << "NO";
      return 0;
    }
    if (t == 0)
      for (int w = 0; w < 4; w++) ans[w] = z[w];
    else {
      if (check(aa) == 3)
        for (int w = 0; w < 4; w++) ans[w] = zz[w];
      else if (check(aa) != check(zz) && check(zz) != 3) {
        cout << "NO";
        return 0;
      }
    }
  }
  for (int w = 0; w < 4; w++) cout << ans[w];
  return 0;
}
