#include<iostream>
#include<algorithm>
#include<string>
#define b(n)c##n=v(B[*(d+n)][i]),
#define g(a,b,k)if(c##a==B[*(d+b)][j])h|=1<<k;
std::string B[8];int u(int f,int r){int t[]={0,2,4,1,3,0,3,0,0,5,0,2,1,5,0,0,0,4,4,0,0,0,5,1,2,0,5,0,0,3,0,3,1,4,2,0};return t[f*6+r];}int q(int h){return 5-h;}int v(int c){return c+(c>96?-32:32);}int o(int f,int x){for(int i=0,c=0;i<6;i++)if(f!=i&&q(f)!=i){if(c==x)return i;c++;}}int w[4],z[4];bool C(int*d,int x,int nest,int*l,int e,bool(*f)(int*)){int c=v(B[*d][x]),i,a;if(nest==3){for(a=0;a<4;a++){int ar=o(e,a);if(c==B[*(d-3)][ar]){l[0]=u(ar,e);return true;}}}else{d++;for(i=0;i<6;i++)if(c==B[*d][i])for(a=0;a<4;a++){int ar=o(i,a);l[nest+1]=u(i,ar);if(C(d,ar,nest+1,l,e,f)){if(nest==2){if(f(d))return true;}else{return true;}}}}return false;}bool S(int*l){l-=7;for(int i=0;i<4;i++)if(v(B[l[i]][q(w[i])])!=B[(l+4)[i]][z[i]])return false;return true;}bool K(int*d){++d;for(int i=0;i<6;i++)if(C(d,i,0,z,i,S))return true;return false;}bool p(int*d){int h=0,i=0,k;for(;i<6;i++){int b(0)b(1)b(2)b(3)b(4)b(5)b(6)b(7)j;for(j=0;j<6;j++){g(0,1,0)g(1,2,1)g(2,3,2)g(3,0,3)g(4,5,4)g(5,6,5)g(6,7,6)g(7,4,7)g(0,4,8)g(1,5,9)g(2,6,10)g(3,7,11)if(h==4095){for(k=0;k<6;k++)if(C(d,k,0,w,k,K)){puts("YES");return true;}return false;}}}return false;}int main(){for(;;){int i,j,k,a,d[8],e[6];for(i=0;i<8;++i){std::getline(std::cin,B[i]);if(B[i]=="0")return 0;}d[0]=0;for(i=1;i<8;++i){d[5]=i;for(j=0,a=1;j<6;++j,++a)e[j]=a==i?++a:a;do{d[3]=e[2];d[4]=e[3];d[6]=e[4];d[7]=e[5];for(k=0;k<2;++k){d[1+k]=e[0];d[2-k]=e[1];if(p(d))goto n;}}while(std::next_permutation(e+1,e+6));}puts("NO");n:;}}