#include <iostream>
#include <cstring>
#include <cctype>	
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

// 0:TOP 1:FRONT 2:RIGHT 3:LEFT 4:BACK 5:BOTTOM
string list[24] = {
	"012345","024135","031425","043215","103254","120534",
	"135024","152304","201453","215043","240513","254103",
	"304152","310542","345012","351402","402351","425031",
	"430521","453201","513240","521430","534120","542310"
};

bool used[8];
string data[8];
char puzzle[6][8];

// eêÉÂ¢ÄobNgbN·éÛÉµª¶¶È¢æ¤mF·é×«Æ±ëB
// ôFnumberAïFface ÉÎµÄ¢éÏÈtH[}bgBIíèÍ -1B
int connect[8][8] = {
	{-1},
	{0,3,-1},		// Êu:0 ÉÊ:3 ªÚ±µÄ¢é
	{1,1,-1},		// Êu:1 ÉÊ:1 ªÚ±µÄ¢é
	{0,1,2,2,-1},	// Êu:0 ÉÊ:1 ªÚ±µAÊu:2 ÉÊ:2 ªÚ±µÄ¢é
	{0,5,-1},		// Êu:0 ÉÊ:5 ªÚ±µÄ¢é
	{1,5,4,3,-1},	// Êu:1 ÉÊ:5 ªÚ±µAÊu:4 ÉÊ:3 ªÚ±µÄ¢é
	{2,5,5,1,-1},	// Êu:2 ÉÊ:5 ªÚ±µAÊu:5 ÉÊ:1 ªÚ±µÄ¢é
	{3,5,4,1,6,2,-1}// Êu:3 ÉÊ:5 ªÚ±µAÊu:4 ÉÊ:1 ªÚ±µAÊu:6 ÉÊ:2 ªÚ±µÄ¢é
};

bool ok (char a, char b )
{
	return (tolower(a ) == tolower(b ) && a != b );
} 

bool backTrack (int cur )
{
	if (cur == 8 )
		return true;

	rep (d, 8 ){
		if (used[d] ) continue;

		used[d] = true;
		rep (i, 24 ){
			rep (j, 6 )
				puzzle[cur][j] = data[d][list[i][j]];

			bool f = true;
			for (int j = 0; connect[cur][j] != -1; j += 2 ){
				int pos = connect[cur][j];
				int face = connect[cur][j+1];
				f &= ok (puzzle[pos][5-face], puzzle[cur][face] );
			} // end for
			if (f )
				if (backTrack(cur + 1 ) )
					return true;
		} // end rep
		used[d] = false;
	} // end rep

	return false;
}
	
int main()
{
	rep (i, 24 )
		rep (j, 6 )
			list[i][j] -= '0';

	while (cin >> data[0] , data[0] != "0" ){
		for (int i = 1; i < 8; i++ )
			cin >> data[i];
		memset (used, false, sizeof (used ) );

		cout << (backTrack (0 ) ? "YES" : "NO" ) << endl;
	} // end while

		
	return 0;
}