#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef pair<P,P> Edge;
typedef long long ll;

// 24ñÅ³ÉàÇé
/*
zñÆ_CXÌÊÌÖW
c0ÍRXgN^ÌøÅ^¦çêéxN^Ìvf
0 c4 0 0
c3 c0 c2 c5
0 c1 0 0
*/
class Dice{
private:
	int yoko;
	int tate;
	int round;
private:
	int face[3][4];
public:
	int getFace(const int idx)const{
		if(idx==0)return face[1][1];
		else if(idx==1)return face[2][1];
		else if(idx==2)return face[1][2];
		else if(idx==3)return face[1][0];
		else if(idx==4)return face[0][1];
        else if(idx==5)return face[1][3];
		return -1;
	}
    Dice(){}
	Dice(vector<int> v){
		init();
		face[1][1]=v[0];
		face[2][1]=v[1];
		face[1][2]=v[2];
		face[1][0]=v[3];
		face[0][1]=v[4];
		face[1][3]=v[5];
	}
private:
	// _CXÌú»
	void init(){
		for(int i=0;i<3;i++)for(int j=0;j<4;j++)face[i][j]=-1;
		yoko=0;
		tate=0;
		round=0;
	}
public:
	// _CXÌñ]
	void rotate(){
		if(round<4){
			int tmp = face[2][1];
			face[2][1]=face[1][2];
			face[1][2]=face[0][1];
			face[0][1]=face[1][0];
			face[1][0]=tmp;
			round++;
		}
		if(round>=4){
			round=0;
			// àÇÁÄ«½çA¡ÌXbgðñ]³¹é
			if(yoko<4){
				int tmp = face[1][3];
				for(int i = 2; i >= 0; i--)
					face[1][i+1]=face[1][i];
				face[1][0]=tmp;
				yoko++;
			}
			// àÇÁÄ«½çAcÌXbgðñ]³¹é
			if(yoko>=4){
				if(tate<4){
					int loop=1;
					if(tate==1)loop=2;
					while(loop--){
						tate++;
						int tmp = face[1][3];
						face[1][3]=face[0][1];
						for(int i = 0; i < 2; i++)
							face[i][1]=face[i+1][1];
						face[2][1]=tmp;
					}
				}
				if(tate>=4){
					round=0;
					tate=0;
					yoko=0;
				}
			}
		}
	};
};

vector<int> idxs;
int cnt;
Dice dices[8];
void dfs(int pos){
    if(pos==0){
        for(int i=0;i<24;i++){
            dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else if(pos==1){
        for(int i=0;i<24;i++){
            // Êª¤©`FbN
            int ch1=dices[idxs[0]].getFace(2);
            int ch2=dices[idxs[pos]].getFace(3);
            if(abs(ch1-ch2)==32)dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else if(pos==2){
        for(int i=0;i<24;i++){
            // Êª¤©`FbN
            int ch1=dices[idxs[1]].getFace(1);
            int ch2=dices[idxs[pos]].getFace(4);
            if(abs(ch1-ch2)==32)dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else if(pos==3){
        for(int i=0;i<24;i++){
            // Êª¤©`FbN
            int ch1=dices[idxs[2]].getFace(3);
            int ch2=dices[idxs[pos]].getFace(2);
            int ch3=dices[idxs[0]].getFace(1);
            int ch4=dices[idxs[pos]].getFace(4);
            if(abs(ch1-ch2)==32&&abs(ch3-ch4)==32)dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else if(pos==4){
        for(int i=0;i<24;i++){
            // Êª¤©`FbN
            int ch1=dices[idxs[0]].getFace(5);
            int ch2=dices[idxs[pos]].getFace(0);
            if(abs(ch1-ch2)==32)dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else if(pos==5){
        for(int i=0;i<24;i++){
            // Êª¤©`FbN
            int ch1=dices[idxs[4]].getFace(2);
            int ch2=dices[idxs[pos]].getFace(3);
            int ch3=dices[idxs[1]].getFace(5);
            int ch4=dices[idxs[pos]].getFace(0);
            if(abs(ch1-ch2)==32&&abs(ch3-ch4)==32)dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else if(pos==6){
        for(int i=0;i<24;i++){
            // Êª¤©`FbN
            int ch1=dices[idxs[5]].getFace(1);
            int ch2=dices[idxs[pos]].getFace(4);
            int ch3=dices[idxs[2]].getFace(5);
            int ch4=dices[idxs[pos]].getFace(0);
            if(abs(ch1-ch2)==32&&abs(ch3-ch4)==32)dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else if(pos==7){
        for(int i=0;i<24;i++){
            // Êª¤©`FbN
            int ch1=dices[idxs[4]].getFace(1);
            int ch2=dices[idxs[pos]].getFace(4);
            int ch3=dices[idxs[6]].getFace(3);
            int ch4=dices[idxs[pos]].getFace(2);
            int ch5=dices[idxs[3]].getFace(5);
            int ch6=dices[idxs[pos]].getFace(0);
            if(abs(ch1-ch2)==32&&abs(ch3-ch4)==32&&abs(ch5-ch6)==32)dfs(pos+1);
            if(cnt>0)return;
            dices[idxs[pos]].rotate();
        }
    }
    else cnt++;
}
int main(){
    string s;
    while(getline(cin,s)&&s!="0"){
        vector<int> d;
        for(int i=0;i<s.size();i++)d.push_back(s[i]);
        dices[0]=Dice(d);
        for(int i=0;i<7;i++){
            d.clear();
            getline(cin,s);
            for(int j=0;j<s.size();j++)d.push_back(s[j]);
            dices[i+1]=Dice(d);
        }
        cnt=0;
        idxs.clear();
        for(int i=0;i<8;i++)idxs.push_back(i);
        // ·ÅÉTõ³ê½àÌðÂÁ±ñÅ¨­
        set<vector<int> > searched;
        do{
            if(searched.find(idxs)!=searched.end()){
                continue;
            }
            dfs(0);
            for(int i=0;i<4;i++){
                searched.insert(idxs);
                for(int base=0;base<2;base++){
                    int a=base*4;
                    int tmp=idxs[3+a];
                    idxs[3+a]=idxs[2+a];
                    idxs[2+a]=idxs[1+a];
                    idxs[1+a]=idxs[0+a];
                    idxs[a]=tmp;
                }
            }
            if(cnt>0)break;
        }while(next_permutation(idxs.begin(),idxs.end()));
        if(cnt>0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }

    return 0;
}