//20
#include<iostream>
#include<cctype>

using namespace std;

char d[8][7];
int p[8];

void rot(char *d,int p){
  int pa[][4]={{0,1,5,4},{0,2,5,3},{1,2,4,3}};
  int *pp=pa[p];
  char t=d[pp[0]];
  d[pp[0]]=d[pp[1]];
  d[pp[1]]=d[pp[2]];
  d[pp[2]]=d[pp[3]];
  d[pp[3]]=t;
}

bool dfs(int u,int r){
  if(r==8){
    return true;
  }else{
    for(int i=0;i<8;i++){
      if(!(u>>i&1)){
	for(int j=0;j<6;j++){
	  rot(d[i],j%2);
	  for(int k=0;k<4;k++){
	    rot(d[i],2);
	    p[r]=i;
	    bool f=true;
	    for(int l=0;l<6;l++){
	      int dx[]={0,0,1,-1,0,0};
	      int dy[]={1,0,0,0,0,-1};
	      int dz[]={0,-1,0,0,1,0};
	      int x=r%2+dx[l];
	      int y=r/2%2+dy[l];
	      int z=r/4+dz[l];
	      int o=z*4+y*2+x;
	      if(((x|y|z)&2)==0&&o<r){
		char cf=d[i][l],pf=d[p[o]][5-l];
		f&=(tolower(cf)==tolower(pf))&&(isupper(cf)^isupper(pf));
	      }
	    }
	    if(f){
	      if(dfs(u|1<<i,r+1)){
		return true;
	      }
	    }
	  }
	}
      }
    }
    return false;
  }
}

int main(){
  for(;;){
    for(int i=0;i<8;i++){
      cin>>d[i];
    }
    if(d[0][0]=='0')break;
    cout<<(dfs(0,0)?"YES":"NO")<<endl;
  }
  return 0;
}