#include <iostream>
#include <stdlib.h>
using namespace std;

int f[8],n[8],v[8];
int d[24][6],da[6][6]={{1,2,3,5,4,6},{2,3,1,4,6,5},{3,2,6,5,1,4},{4,2,1,5,6,3},{5,4,1,3,6,2},{6,5,3,2,4,1}};
char pd[8][7];

int check(int k) {
	int i,j,s;
	for (i=1;i<8;i++) {
		if (f[i]==1) continue;
		f[i]=1; n[k]=i; 
		for (j=0;j<24;j++) {
			v[k]=j; s=0;
			switch(k) {
				case 1: if (abs(pd[0][d[v[0]][3]]-pd[i][d[j][1]]) == 32) s=check(2); break;
				case 2: if (abs(pd[0][d[v[0]][2]]-pd[i][d[j][4]]) == 32) s=check(3); break;
				case 3: if (abs(pd[0][d[v[0]][0]]-pd[i][d[j][5]]) == 32) s=check(4); break;
				case 4: if (abs(pd[n[1]][d[v[1]][2]]-pd[i][d[j][4]]) == 32 && abs(pd[n[2]][d[v[2]][3]]-pd[i][d[j][1]]) == 32) s=check(5); break;
				case 5: if (abs(pd[n[3]][d[v[3]][3]]-pd[i][d[j][1]]) == 32 && abs(pd[n[1]][d[v[1]][0]]-pd[i][d[j][5]]) == 32) s=check(6); break;
				case 6: if (abs(pd[n[3]][d[v[3]][2]]-pd[i][d[j][4]]) == 32 && abs(pd[n[2]][d[v[2]][0]]-pd[i][d[j][5]]) == 32) s=check(7); break;
				case 7: if (abs(pd[n[6]][d[v[6]][3]]-pd[i][d[j][1]]) == 32 &&
				             abs(pd[n[5]][d[v[5]][2]]-pd[i][d[j][4]]) == 32 &&
				             abs(pd[n[4]][d[v[4]][0]]-pd[i][d[j][5]]) == 32 ) s=1;
				            break;
						}
						if (s==1) return 1;
			}
			f[i]=0;
		}
	return 0;
}

int main() {
	int i,j,k,m;
	for (i=0;i<6;i++) {
		for (j=0;j<4;j++) {
		 for (k=0;k<6;k++) d[i*4+j][k]=da[i][k]-1;
		 m=da[i][1]; 
		 for (k=1;k<4;k++) da[i][k]=da[i][k+1];
		 da[i][4]=m;
	 }
 }	
 
	while(cin >> pd[0]) {
		if (pd[0][0]=='0') break;
		for (i=1;i<8;i++) { cin >> pd[i]; f[i]=0;}
		for (i=0;i<24;i++) { v[0]=i; if (check(1)==1) break; }
		if (i==24) cout << "NO" << endl; else cout << "YES" << endl;
	}	
	return 0;
}