#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;

string dice[8];
bool use[8];
string cube[8];

string dir(int x,int y){
  char res[6],tmp[6];
  int a = y/4,b = y%4;

  for(int i=0;i<6;i++)res[i] = dice[x][i];

  for(int i=0;i<a;i++){
    tmp[0] = res[1];
    tmp[1] = res[0];
    tmp[2] = res[3];
    tmp[3] = res[2];
    tmp[4] = res[5];
    tmp[5] = res[4];
    for(int j=0;j<6;j++)res[j] = tmp[j];
  }

  for(int i=0;i<b;i++)rotate(res+1,res+2,res+5);
  string result;
  for(int i=0;i<6;i++)result.push_back(res[i]);
  return result;
}

char trans(char a){
  if('a'<=a && a<='z')return a-32;
  else return a+32;
}

bool rec(int times){
  if(times == 8)return true;
  for(int i=0;i<8;i++){
    if(!use[i]){
      bool f = true;
      char ex;
      if(times%2){
	bool f2 = false;
	ex = trans(cube[times-1][5]);
	for(int j=0;j<6;j++)
	  if(dice[i][j]==ex)f2 = true;
	f &= f2;
      }

      if(times%4>=2){
	bool f2 = false;
	ex = trans(cube[times-2][3]);
	for(int j=0;j<6;j++)
	  if(dice[i][j]==ex)f2 = true;
	f &= f2;
      }
      if(times>=4){
	bool f2 = false;
	ex = trans(cube[times-4][4]);
	for(int j=0;j<6;j++)
	  if(dice[i][j]==ex)f2 = true;
	f &= f2;
      }
      if(f){
	use[i] = true;
	for(int j=0;j<24;j++){
	  string tmp = dir(i,j);
	  f = true;
	  if(times%2){
	    if(trans(tmp[0])!=cube[times-1][5])f = false;
	  }
	  if(times%4>=2){
	    if(trans(tmp[2])!=cube[times-2][3])f = false;
	  }
	  if(times>=4){
	    if(trans(tmp[1])!=cube[times-4][4])f = false;
	  }
	  if(f){
	    cube[times] = tmp;
	  if(rec(times+1))return true;
	  }
	}
	use[i] = false;
      }
    }
  }

  return false;
}

int main(){
  for(;;){
    cin >> dice[0];
    if(dice[0] == "0")break;
    for(int i=1;i<8;i++)cin >> dice[i];
    for(int i=0;i<8;i++)use[i] = false;

    if(rec(0))cout << "YES\n";
    else cout << "NO\n";
  }
}