#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;

char in[8][7],pat[192][7];
int d[8];
bool use[8];

void rot(int nm,int xyz)
{
	char *s=in[nm],t;
	if(xyz==0)
	{
		t=s[1]; s[1]=s[2]; s[2]=s[4];
		s[4]=s[3]; s[3]=t; return;
	}
	if(xyz==1)
	{
		t=s[0]; s[0]=s[1]; s[1]=s[5];
		s[5]=s[4]; s[4]=t; return;
	}
	t=s[0]; s[0]=s[2]; s[2]=s[5];
	s[5]=s[3]; s[3]=t;
}
bool ok(int d1,int f1,int d2,int f2)
{
	d1=d[d1]; d2=d[d2];
	if(d1<0||d2<0)return 1;
	char c1=pat[d1][f1],c2=pat[d2][f2];
	return tolower(c1)==tolower(c2)&&c1!=c2;
}
bool ck()
{
	if(!ok(0,2,1,3)||!ok(0,4,2,1)||//1ツ階ツ督ッツ士
		!ok(2,2,3,3)||!ok(1,4,3,1)||
		!ok(0,0,4,5)||!ok(1,0,5,5)||//1-2ツ階
		!ok(2,0,6,5)||!ok(3,0,7,5)||
		!ok(4,2,5,3)||!ok(4,4,6,1)||//2ツ階ツ督ッツ士
		!ok(6,2,7,3)||!ok(5,4,7,1)
	)return 0;
	return 1;
}
bool dfs(int c)
{
	if(c==8)return 1;
	rep(i,8)if(!use[i])rep(j,24)
	{
		d[c]=i*24+j; use[i]=1;
		if(ck()&&dfs(c+1))return 1;
		d[c]=-1; use[i]=0;
	}
	return 0;
}
int main()
{
	while(scanf("%s",in[0]),in[0][0]!='0')
	{
		rep(i,7)scanf("%s",in+i+1);
		rep(i,8)use[i]=0,d[i]=-1;
		use[0]=1;
		
		int m=0;
		rep(i,8)
		{
			set<string> S;
			rep(x,4)
			{
				rep(y,4)
				{
					rep(z,4)
					{
						S.insert(in[i]);
						rot(i,0);
					}
					rot(i,1);
				}
				rot(i,2);
			}
			fr(it,S)strcpy(pat[m++],it->c_str());
		}
		rep(i,24)
		{
			d[0]=i;
			if(dfs(1))
			{
				puts("YES"); goto END;
			}
		}
		puts("NO"); END:;
	}
	return 0;
}