// yukicoder: No.233 めぐるはめぐる (3)
// bal4u 2019.8.25

#include <stdio.h>
#include <stdlib.h>

typedef long long ll;

//// 高速入力
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in() {   // 非負整数の入力
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

char c2d[128];
char d2c[] = "_aeiubgmnr";

ll ins() {   // 文字列の特殊入力
	ll n = 0; int c = gc();
	do n = 10 * n + c2d[c]; while ((c = gc()) > ' ');
	return n;
}

void outs(char *s) { while (*s) pc(*s++); pc('\n'); }

char s[15];
void pr(ll x) {
	int i;
	for (i = 10; i >= 0; i--) s[i] = d2c[x % 10], x /= 10;
	outs(s);
}

// 数値のハッシュ関数
#define HASHSIZ 1296007
ll hash[HASHSIZ+5], *hashend = hash+HASHSIZ;

int lookup(ll n) {
	ll *p = hash + (int)(n % HASHSIZ);
	while (*p) {
		if (*p == n) return 1;
		if (++p == hashend) p = hash;
	}
	return 0;
}

void insert(ll n) {
	ll *p = hash + (int)(n % HASHSIZ);
	while (*p) {
		if (*p == n) return;
		if (++p == hashend) p = hash;
	}
	*p = n;
}

//// 本問題関連

// char d2c[] = "_aeiubgmnr";
char code[11] = { 1,1,2,3,4,4,5,6,7,8,9 };
char f[11];

void rec(int id, ll x, int bo) {
	int i, j; ll y, z;
	if (id == 11) {
		if (!lookup(x)) { pr(x); exit(0); }
		return;
	}
	for (i = 6; i < 11; i++) {
		if (f[i]) continue;
		f[i] = 1, y = x * 10 + code[i];
		for (j = 0; j < 6; j++) {
			if (f[j]) continue;
			f[j] = 1, z = y * 10 + code[j];
			rec(id+2, z, bo);
			f[j] = 0;
		}
		f[i] = 0;
	}
	if (!bo) {
		for (i = 0; i < 6; i++) {
			if (f[i]) continue;
			f[i] = 1, y = x * 10 + code[i];
			rec(id+1, y, 1);
			f[i] = 0;
		}
	}
}
		
int main()
{
	int i, N;

	for (i = 0; d2c[i]; i++) c2d[d2c[i]] = i;
	N = in();
	if (N == 129600) { outs("NO"); return 0; }
	while (N--) insert(ins());
	
	rec(0, 0, 0);
	outs("NO");
	return 0;
}