#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstring>
using namespace std;
char a[8][7];
int b[8],c[8],d[6][6]={};
int ff();
int fg();
int fh();
int fi();
int fj();
int fk();
int fm();
void fn(char a[],char s){
  if(0){
  }else if(s=='l'){
    char s=a[1];
    a[1]=a[3];
    a[3]=a[4];
    a[4]=a[2];
    a[2]=s;
  }else if(s=='r'){
    char s=a[1];
    a[1]=a[2];
    a[2]=a[4];
    a[4]=a[3];
    a[3]=s;
  }else if(s=='s'){
    char s=a[0];
    a[0]=a[4];
    a[4]=a[5];
    a[5]=a[1];
    a[1]=s;
  }else if(s=='n'){
    char s=a[0];
    a[0]=a[1];
    a[1]=a[5];
    a[5]=a[4];
    a[4]=s;
  }else if(s=='w'){
    char s=a[0];
    a[0]=a[2];
    a[2]=a[5];
    a[5]=a[3];
    a[3]=s;
  }else if(s=='e'){
    char s=a[0];
    a[0]=a[3];
    a[3]=a[5];
    a[5]=a[2];
    a[2]=s;
  }
  return;
}
void fl(char a[],int p,int q,char r){
  if(0){
  }else if(p==0){
    if(0){
    }else if(q==1){
      fn(a,'s');
    }else if(q==2){
      fn(a,'e');
    }else if(q==3){
      fn(a,'w');
    }else if(q==4){
      fn(a,'n');
    }else if(q==5){
      fn(a,r);
      fn(a,r);
    }
  }else if(p==1){
    if(0){
    }else if(q==0){
      fn(a,'n');
    }else if(q==2){
      fn(a,'l');
    }else if(q==3){
      fn(a,'r');
    }else if(q==4){
      fn(a,r);
      fn(a,r);
    }else if(q==5){
      fn(a,'s');
    }
  }else if(p==2){
    if(0){
    }else if(q==0){
      fn(a,'w');
    }else if(q==1){
      fn(a,'r');
    }else if(q==3){
      fn(a,r);
      fn(a,r);
    }else if(q==4){
      fn(a,'l');
    }else if(q==5){
      fn(a,'e');
    }
  }else if(p==3){
    if(0){
    }else if(q==0){
      fn(a,'e');
    }else if(q==1){
      fn(a,'l');
    }else if(q==2){
      fn(a,r);
      fn(a,r);
    }else if(q==4){
      fn(a,'r');
    }else if(q==5){
      fn(a,'w');
    }
  }else if(p==4){
    if(0){
    }else if(q==0){
      fn(a,'s');
    }else if(q==1){
      fn(a,r);
      fn(a,r);
    }else if(q==2){
      fn(a,'r');
    }else if(q==3){
      fn(a,'l');
    }else if(q==5){
      fn(a,'n');
    }
  }else if(p==5){
    if(0){
    }else if(q==0){
      fn(a,r);
      fn(a,r);
    }else if(q==1){
      fn(a,'n');
    }else if(q==2){
      fn(a,'w');
    }else if(q==3){
      fn(a,'e');
    }else if(q==4){
      fn(a,'s');
    }
  }
  return;
}
int fm(){
  int i,j;
  for(i=0;i<8;++i){
    char* p;
    if(b[i]&&(p=strchr(a[i],'a'<=a[c[0]][2]&&a[c[0]][2]<='z'?a[c[0]][2]+'A'-'a':a[c[0]][2]+'a'-'A'))!=NULL){
      b[i]=0;
      c[1]=i;
      fl(a[i],p-a[i],3,'n');
      for(j=0;j<4;++j){
	if(fk())
	  return 1;
	fn(a[i],'n');
      }
      b[i]=-1;
    }
  }
  return 0;
}
int fk(){
  int i,j;
  for(i=0;i<8;++i){
    char* p;
    if(b[i]&&(p=strchr(a[i],'a'<=a[c[0]][4]&&a[c[0]][4]<='z'?a[c[0]][4]+'A'-'a':a[c[0]][4]+'a'-'A'))!=NULL){
      b[i]=0;
      c[2]=i;
      fl(a[i],p-a[i],1,'n');
      for(j=0;j<4;++j){
	if(fj())
	  return 1;
	fn(a[i],'e');
      }
      b[i]=-1;
    }
  }
  return 0;
}
int fj(){
  int i;
  for(i=0;i<8;++i){
    char* p,* q;
    if(b[i]&&(p=strchr(a[i],'a'<=a[c[1]][4]&&a[c[1]][4]<='z'?a[c[1]][4]+'A'-'a':a[c[1]][4]+'a'-'A'))!=NULL&&(q=strchr(a[i],'a'<=a[c[2]][2]&&a[c[2]][2]<='z'?a[c[2]][2]+'A'-'a':a[c[2]][2]+'a'-'A'))!=NULL&&d[p-a[i]][q-a[i]]){
      b[i]=0;
      c[3]=i;
      fl(a[i],p-a[i],1,'n');
      q=strchr(a[i],'a'<=a[c[2]][2]&&a[c[2]][2]<='z'?a[c[2]][2]+'A'-'a':a[c[2]][2]+'a'-'A');
      fl(a[i],q-a[i],3,'e');
      if(fi())
	return 1;
      b[i]=-1;
    }
  }
  return 0;
}
int fi(){
  int i,j;
  for(i=0;i<8;++i){
    char* p;
    if(b[i]&&(p=strchr(a[i],'a'<=a[c[0]][0]&&a[c[0]][0]<='z'?a[c[0]][0]+'A'-'a':a[c[0]][0]+'a'-'A'))!=NULL){
      b[i]=0;
      c[4]=i;
      fl(a[i],p-a[i],5,'n');
      for(j=0;j<4;++j){
	if(fh())
	  return 1;
	fn(a[i],'l');
      }
      b[i]=-1;
    }
  }
  return 0;
}
int fh(){
  int i;
  for(i=0;i<8;++i){
    char* p,* q;
    if(b[i]&&(p=strchr(a[i],'a'<=a[c[1]][0]&&a[c[1]][0]<='z'?a[c[1]][0]+'A'-'a':a[c[1]][0]+'a'-'A'))!=NULL&&(q=strchr(a[i],'a'<=a[c[4]][2]&&a[c[4]][2]<='z'?a[c[4]][2]+'A'-'a':a[c[4]][2]+'a'-'A'))!=NULL&&d[p-a[i]][q-a[i]]){
      b[i]=0;
      c[5]=i;
      fl(a[i],p-a[i],5,'n');
      q=strchr(a[i],'a'<=a[c[4]][2]&&a[c[4]][2]<='z'?a[c[4]][2]+'A'-'a':a[c[4]][2]+'a'-'A');
      fl(a[i],q-a[i],3,'n');
      if(fg())
	return 1;
      b[i]=-1;
    }
  }
  return 0;
}
int fg(){
  int i;
  for(i=0;i<8;++i){
    char* p,* q;
    if(b[i]&&(p=strchr(a[i],'a'<=a[c[2]][0]&&a[c[2]][0]<='z'?a[c[2]][0]+'A'-'a':a[c[2]][0]+'a'-'A'))!=NULL&&(q=strchr(a[i],'a'<=a[c[4]][4]&&a[c[4]][4]<='z'?a[c[4]][4]+'A'-'a':a[c[4]][4]+'a'-'A'))!=NULL&&d[p-a[i]][q-a[i]]){
      b[i]=0;
      c[6]=i;
      fl(a[i],p-a[i],5,'n');
      q=strchr(a[i],'a'<=a[c[4]][4]&&a[c[4]][4]<='z'?a[c[4]][4]+'A'-'a':a[c[4]][4]+'a'-'A');
      fl(a[i],q-a[i],1,'e');
      if(ff())
	return 1;
      b[i]=-1;
    }
  }
  return 0;
}
int ff(){
  int i;
  for(i=0;i<8;++i){
    char* p,* q,* r;
    if(b[i]&&(p=strchr(a[i],'a'<=a[c[3]][0]&&a[c[3]][0]<='z'?a[c[3]][0]+'A'-'a':a[c[3]][0]+'a'-'A'))!=NULL&&(q=strchr(a[i],'a'<=a[c[5]][4]&&a[c[5]][4]<='z'?a[c[5]][4]+'A'-'a':a[c[5]][4]+'a'-'A'))!=NULL&&(r=strchr(a[i],'a'<=a[c[6]][2]&&a[c[6]][2]<='z'?a[c[6]][2]+'A'-'a':a[c[6]][2]+'a'-'A'))!=NULL&&d[p-a[i]][q-a[i]]&&d[p-a[i]][r-a[i]]&&d[q-a[i]][r-a[i]]){
      b[i]=0;
      c[7]=i;
      fl(a[i],p-a[i],5,'n');
      q=strchr(a[i],'a'<=a[c[5]][4]&&a[c[5]][4]<='z'?a[c[5]][4]+'A'-'a':a[c[5]][4]+'a'-'A');
      fl(a[i],q-a[i],1,'e');
      r=strchr(a[i],'a'<=a[c[6]][2]&&a[c[6]][2]<='z'?a[c[6]][2]+'A'-'a':a[c[6]][2]+'a'-'A');
      if(r-a[i]==3)
	return 1;
    }
  }
  return 0;
}

int main(){
  int i;
  d[0][1]=d[0][2]=d[0][3]=d[0][4]=-1;
  d[1][0]=d[1][2]=d[1][3]=d[1][5]=-1;
  d[2][0]=d[2][1]=d[2][4]=d[2][5]=-1;
  d[3][0]=d[3][1]=d[3][4]=d[3][5]=-1;
  d[4][0]=d[4][2]=d[4][3]=d[4][5]=-1;
  d[5][1]=d[5][2]=d[5][3]=d[5][4]=-1;
  while(cin>>a[0],a[0][0]!='0'){
    for(i=1;i<8;++i)
      cin>>a[i];
    memset(b,-1,sizeof(b));
    b[0]=0;
    c[0]=0;
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'e');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'e');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'w');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'w');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'e');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    fn(a[0],'l');
    if(fm()){
      cout<<"YES"<<endl;
      continue;
    }
    cout<<"NO"<<endl;
  }
  return 0;
}