#include <string>
#include <vector>
#include <cmath>
#include <ctime>
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <limits>
using namespace std;
typedef long long ll;

enum Face {
	C1, C2, C3, C4, C5, C6, FACE_SIZE
};

struct Dice {
	char face[FACE_SIZE];

	Dice(){}
	Dice(const string &init){
		for(int i=0;i<FACE_SIZE;i++)face[i] = init[i];
	}

	void roll_y(){
		roll(C2, C3, C5, C4);
	}

	void roll_x(){
		roll(C2, C6, C5, C1);
	}

	void roll_z(){
		roll(C1, C3, C6, C4);
	}

	void roll(Face a, Face b, Face c, Face d){
		char tmp = face[d];
		face[d] = face[c];
		face[c] = face[b];
		face[b] = face[a];
		face[a] = tmp;
	}

	char at(Face a) const {
		return face[a];
	}
};


int dx[] =  {0, 0,  1, -1, 0, 0};
int dy[] =  {1, -1, 0,  0, 0, 0};
int dz[] =  {0, 0,  0,  0, 1, -1};
Face from[] = {C6, C1, C3, C4, C5, C2};
Face to[] =   {C1, C6, C4, C3, C2, C5};


bool valid[300][300];


Dice rolls[8][24];

bool used[2][2][2];
Dice cube[2][2][2];

bool dfs(int n, int mask){
	if(n >= 8)return true;

	int m = n;
	int x = m % 2; m /= 2;
	int y = m % 2; m /= 2;
	int z = m;

	for(int i=0;i<8;i++){
		if((mask >> i) & 1)continue;

		for(int r=0;r<24;r++){
			Dice dice = rolls[i][r];
			bool ok = true;

			for(int k=0;k<6;k++){
				int nz = z + dz[k];
				int ny = y + dy[k];
				int nx = x + dx[k];

				if(nz < 0 || nz >= 2 || ny < 0 || ny >= 2 || nx < 0 || nx >= 2)continue;
				if(!used[nz][ny][nx])continue;

				if(!valid[ dice.at(from[k]) ][ cube[nz][ny][nx].at(to[k]) ]){
					ok = false;
					break;
				}
			}

			if(!ok)continue;

			used[z][y][x] = true;
			cube[z][y][x] = dice;


			if(dfs(n + 1, mask | (1 << i)))return true;

			used[z][y][x] = false;

		}
	}

	return false;
}

inline string solve(const vector<Dice> &dice_vec){
	for(int i=0;i<dice_vec.size();i++){
		Dice dice = dice_vec[i];

		int id = 0;
		for(int k=0;k<6;(k&1?dice.roll_y():dice.roll_x()),k++){
			for(int j=0;j<4;dice.roll_z(),j++){
				rolls[i][id] = dice;

				++id;
			}
		}
	}

	memset(used, false, sizeof(used));
	return dfs(0, 0) ? "YES" : "NO";
}

int main(){
	memset(valid, false, sizeof(valid));
	for(int i=0;i<26;i++){
		char a = 'a' + i;
		char b = 'A' + i;
		valid[a][b] = true;
		valid[b][a] = true;
	}

	string init;
	while(cin >> init){
		if(init == "0")break;

		vector<Dice> dices;
		dices.push_back(Dice(init));

		for(int t=0;t<7;t++){
			cin >> init;
			dices.push_back(Dice(init));
		}

		cout << solve(dices) << endl;
	}

	return 0;
}