#include <bits/stdc++.h>
typedef struct node {
  char str[10001];
} node;
node poem[4];
long n, k;
int q[3];
int find_v(char *str, int t) {
  int i, tmp;
  tmp = strlen(str);
  for (i = tmp - 1; i >= 0; i--) {
    if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' ||
        str[i] == 'u')
      t--;
    if (!t) return i;
  }
  return i;
}
int check(int classify) {
  int v0, v1, v2, v3, t1, t2;
  if (classify == 0) {
    v0 = find_v(poem[0].str, k);
    if (v0 < 0) return 0;
    v1 = find_v(poem[1].str, k);
    if (v1 < 0) return 0;
    v2 = find_v(poem[2].str, k);
    if (v2 < 0) return 0;
    v3 = find_v(poem[3].str, k);
    if (v3 < 0) return 0;
    t1 = strlen(poem[0].str + v0);
    t2 = strlen(poem[2].str + v2);
    if (memcmp(poem[0].str + v0, poem[1].str + v1, t1) != 0) return 0;
    if (memcmp(poem[2].str + v2, poem[3].str + v3, t2) != 0) return 0;
    return 1;
  }
  if (classify == 1) {
    v0 = find_v(poem[0].str, k);
    if (v0 < 0) return 0;
    v1 = find_v(poem[1].str, k);
    if (v1 < 0) return 0;
    v2 = find_v(poem[2].str, k);
    if (v2 < 0) return 0;
    v3 = find_v(poem[3].str, k);
    if (memcmp(poem[0].str + v0, poem[2].str + v2, strlen(poem[0].str + v0)) !=
        0)
      return 0;
    if (memcmp(poem[1].str + v1, poem[3].str + v3, strlen(poem[1].str + v1)) !=
        0)
      return 0;
    return 1;
  }
  if (classify == 2) {
    v0 = find_v(poem[0].str, k);
    if (v0 < 0) return 0;
    v1 = find_v(poem[1].str, k);
    if (v1 < 0) return 0;
    v2 = find_v(poem[2].str, k);
    if (v2 < 0) return 0;
    v3 = find_v(poem[3].str, k);
    if (memcmp(poem[0].str + v0, poem[3].str + v3, strlen(poem[0].str + v0)) !=
        0)
      return 0;
    if (memcmp(poem[1].str + v1, poem[2].str + v2, strlen(poem[1].str + v1)) !=
        0)
      return 0;
    return 1;
  }
  return 0;
}
int main() {
  int i, j, s, flag = 0;
  scanf("%ld%ld", &n, &k);
  q[0] = q[1] = q[2] = 1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < 4; j++) scanf("%s", poem[j].str);
    for (s = 0; s < 3; s++)
      if (q[s])
        if (!check(s)) q[s] = 0;
    if (q[0] == 0 && q[1] == 0 && q[2] == 0) break;
  }
  if (q[0] && !q[1] && !q[2] && !flag) {
    printf("aabb\n");
    flag = 1;
  }
  if (!q[0] && q[1] && !q[2] && !flag) {
    printf("abab\n");
    flag = 1;
  }
  if (!q[0] && !q[1] && q[2] && !flag) {
    printf("abba\n");
    flag = 1;
  }
  if (!q[0] && !q[1] && !q[2] && !flag) {
    printf("NO\n");
    flag = 1;
  }
  if (!flag) printf("aaaa\n");
  return 0;
}
