#include<cctype>
#include<string>
#include<iostream>
#include<algorithm>

using namespace std;

/*  ________
   / D /   /|
  /---/---/C|
 /__ /__ /|/|
| A | B | /G|
|___|___|/|/
| E | F | /
|___|___|/
*/

int rotx(string &dice){
	char t=dice[0];
	dice[0]=dice[1];
	dice[1]=dice[5];
	dice[5]=dice[4];
	dice[4]=t;
}

int roty(string &dice){
	char t=dice[0];
	dice[0]=dice[3];
	dice[3]=dice[5];
	dice[5]=dice[2];
	dice[2]=t;
}

int rotz(string &dice){
	char t=dice[1];
	dice[1]=dice[3];
	dice[3]=dice[4];
	dice[4]=dice[2];
	dice[2]=t;
}

void next(string &dice,int i){
	if(i%4==0){
		if(i%8==0)	rotx(dice);
		else		roty(dice);
	}
	rotz(dice);
}
/*
int up[6][6]={
{0,1,2,3,4,5},
{1,5,2,3,0,4},
{2,1,5,0,4,3},
{3,1,0,5,4,2},
{4,0,2,3,5,1},
{5,1,3,2,4,0}
};
*/
bool match(char a,char b){
	return (a!=b)&&(toupper(a)==toupper(b));
}

int main(){
	string dice[8];
	while(1){
		for(int i=0;i<8;i++)	cin>>dice[i];
		if(dice[0]=="0")	break;

		bool ok=false;
		int i[]={0,1,2,3,4,5,6,7};
		string diceA,diceB,diceC,diceD,diceE,diceF,diceG,diceH;
		do{	// fix the order of 8 dices
			diceA=dice[i[0]];
			diceB=dice[i[1]];
			diceC=dice[i[2]];
			diceD=dice[i[3]];
			diceE=dice[i[4]];
			diceF=dice[i[5]];
			diceG=dice[i[6]];
			diceH=dice[i[7]];
			for(int ia=0;ia<24;ia++,next(diceA,ia)){	// fix diceA's direction
				for(int ib=0;ib<24;ib++,next(diceB,ib)){	// fix diceB's direction
					if(!match(diceA[2],diceB[3]))	continue;
					for(int ic=0;ic<24;ic++,next(diceC,ic)){	// fix diceC's ...
						if(!match(diceB[4],diceC[1]))	continue;
						for(int id=0;id<24;id++,next(diceD,id)){
							if(!match(diceA[4],diceD[1]) || !match(diceC[3],diceD[2]))	continue;
							for(int ie=0;ie<24;ie++,next(diceE,ie)){
								if(!match(diceA[5],diceE[0]))	continue;
								for(int iF=0;iF<24;iF++,next(diceF,iF)){
									if(!match(diceB[5],diceF[0]) || !match(diceE[2],diceF[3]))	continue;
									for(int ig=0;ig<24;ig++,next(diceG,ig)){
										if(!match(diceC[5],diceG[0]) || !match(diceF[4],diceG[1]))	continue;
										for(int ih=0;ih<24;ih++,next(diceH,ih)){
											if(!match(diceD[5],diceH[0]) || !match(diceE[4],diceH[1]) || !match(diceG[3],diceH[2]))	continue;
											ok=true;
											goto FOUND;
										}
									}
								}
							}
						}
					}
				}
			}
		}while(next_permutation(i,i+8));

		FOUND:
		cout<<(ok?"YES":"NO")<<endl;
	}

	return 0;
}