#include<bits/stdc++.h>

using namespace std;

string CubeInfo[8];
pair<int, int*> Selected[8];
bool Used[8];
//top front right left back bottom
int RotateBase[24][6] = {
	{ 0,1,2,3,4,5 },{},{},{},
	{ 1,5,2,3,0,4 },{},{},{},
	{ 2,1,5,0,4,3 },{},{},{},
	{ 3,1,0,5,4,2 },{},{},{},
	{ 4,0,2,3,5,1 },{},{},{},
	{ 5,4,2,3,1,0 },{},{},{},
};


void fullRotateBase() {
	int tmp[6], num;

	for (int i = 0; i < 21; i += 4) {
		for (int j = 0; j < 6; ++j) {
			tmp[j] = RotateBase[i][j];
		}
		for (int k = 1; k < 4; ++k) {
			num = tmp[1];
			tmp[1] = tmp[3];
			tmp[3] = tmp[4];
			tmp[4] = tmp[2];
			tmp[2] = num;
			for (int j = 0; j < 6; ++j) {
				RotateBase[i + k][j] = tmp[j];
			}
		}
	}
}

bool checkSame(int dice1, int pos1, int dice2, int id, int pos2) {
	char c1, c2;

	c1 = CubeInfo[Selected[dice1].first][Selected[dice1].second[pos1]];
	c2 = CubeInfo[dice2][RotateBase[id][pos2]];

	if (abs(c1 - c2) == 32) {
		return true;
	}
	return false;
}

int solve(int currentId) {
	bool flag;

	if (currentId == 8) {
		return true;
	}

	for (int i = 0; i < 8; ++i) {
		if (Used[i]) {
			continue;
		}
		Used[i] = true;
		for (int id = 0; id < 24; ++id) {
			flag = false;
			//cout << "pos:" << currentId << " =(now_" << i + 1 << ")_pattern:" << setw(2) << id+1 << " = " << StrTmp[currentId] << endl;
			switch (currentId)
			{
			case 0:flag = true; break;
			case 1:
				if (checkSame(0, 2, i, id, 3)) {
					flag = true;
				}
				break;
			case 2:
				if (checkSame(0, 1, i, id, 4)) {
					flag = true;
				}
				break;
			case 3:
				if (checkSame(1, 1, i, id, 4) && checkSame(2, 2, i, id, 3)) {
					flag = true;
				}
				break;
			case 4:
				if (checkSame(0, 5, i, id, 0)) {
					flag = true;
				}
				break;
			case 5:
				if (checkSame(1, 5, i, id, 0) && checkSame(4, 2, i, id, 3)) {
					flag = true;
				}
				break;
			case 6:
				if (checkSame(2, 5, i, id, 0) && checkSame(4, 1, i, id, 4)) {
					flag = true;
				}
				break;
			case 7:
				if (checkSame(3, 5, i, id, 0) && checkSame(5, 1, i, id, 4) && checkSame(6, 2, i, id, 3)) {
					flag = true;
				}
				break;
			default:
				break;
			}
			Selected[currentId] = make_pair(i, RotateBase[id]);
			if (flag && solve(currentId + 1)) {
				return true;
			}
		}
		Used[i] = false;
	}
	return false;
}

int main() {
	int cnt;
	string str;

	fullRotateBase();
	cnt = 0;
	while (cin >> str, str[0] != '0') {
		CubeInfo[cnt] = str;
		++cnt;
		while (cnt != 8) {
			cin >> str;
			CubeInfo[cnt] = str;
			++cnt;
		}
		//show:
		/*for (int i = 0; i < cnt; ++i) {
		cout << CubeInfo[i] << endl;
		}*/
		memset(Used, false, sizeof(Used));
		memset(Selected, 0, sizeof(Selected));
		if (solve(0)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
		cnt = 0;
	}

	return 0;
}
