#include<iostream>
#include<cmath>
#include<cstdio>
#include<cassert>
#include<climits>
#include<algorithm>
#include<vector>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)

using namespace std;

enum FACE { TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT };
template <class T>
class dice {
public:
  dice() {
    id[TOP] = 0; id[FRONT] = 1; id[LEFT] = 2;
    id[RIGHT] = 3; id[BACK] = 4; id[BOTTOM] = 5;
  }
  T& operator[] (FACE f) { return var[id[f]]; }
  const T& operator[] (FACE f) const { return var[id[f]]; }
  bool operator==(const dice<T>& b) const {
    const dice<T> &a = *this;
    return a[TOP] == b[TOP] && a[BOTTOM] == b[BOTTOM] &&
      a[FRONT] == b[FRONT] && a[BACK] == b[BACK] &&
      a[LEFT] == b[LEFT] && a[RIGHT] == b[RIGHT];
  }
  void roll_x() { roll(TOP, BACK, BOTTOM, FRONT); }
  void roll_y() { roll(TOP, LEFT, BOTTOM, RIGHT); }
  void roll_z() { roll(FRONT, RIGHT, BACK, LEFT); }
  vector<dice> all_rolls() {
    vector<dice> ret;
    for (int k = 0; k < 6; (k&1?roll_y():roll_x()),++k)
      for (int i = 0; i < 4; roll_z(), ++i)
        ret.push_back(*this);
    return ret;
  }
  bool equivalent_to(const dice& di) {
    for (int k = 0; k < 6; (k&1?roll_y():roll_x()),++k)
      for (int i = 0; i < 4; roll_z(), ++i)
        if (*this == di) return true;
    return false;
  }
private:
  void roll(FACE a, FACE b, FACE c, FACE d) {
    T tmp = id[a];
    id[a] = id[b]; id[b] = id[c];
    id[c] = id[d]; id[d] = tmp;
  }
  T var[6];
  int id[6];
};

FACE face[] = {TOP,FRONT,RIGHT,LEFT,BACK,BOTTOM};

int dx[] = {-1,0,0};
int dy[] = {0,-1,0};
int dz[] = {0,0,-1};
FACE dc[] = {RIGHT,FRONT,BOTTOM};
FACE rdc[] = {LEFT,BACK,TOP};
dice<char> field[2][2][2];
bool found;

void dfs(int x,int y,int z,int state,vector<dice<char> >& dices)
{
  if(found)return;
  if(state >= (1<<8)-1)
    {
      found = true;
      return;
    }

  rep(i,8)
    {
      if((state>>i) & 1)continue;
      vector<dice<char> > next = dices[i].all_rolls();
      rep(j,next.size())
	{
	  bool ok = true;
	  rep(k,3)
	    {
	      int nx = x + dx[k];
	      int ny = y + dy[k];
	      int nz = z + dz[k];
	      if(!( 0 <= nx && nx < 2 && 0 <= ny && ny < 2 && 0 <= nz && nz < 2 ))continue;
	      char a = field[nz][ny][nx][dc[k]];
	      char b = next[j][rdc[k]];
	      if(!(a != b && tolower(a) == tolower(b) ))
		{
		  ok = false;
		  break;
		}
	    }

	  int nx = x + 1;
	  int ny = y;
	  int nz = z;
	  if(nx >= 2)nx %= 2, ny++;
	  if(ny >= 2)ny %= 2, nz++;

	  if(ok)
	    {
	      field[z][y][x] = next[j];
	      dfs(nx,ny,nz,state|(1<<i),dices);
	      if(found)return;
	    }
	}
    }

}

int main()
{
  while(true)
    {
      vector<dice<char> > dices((8),dice<char>());
      rep(i,8)
	{
	  rep(j,6)
	    {
	      cin >> dices[i][face[j]];
	      if(dices[i][face[j]] == '0')goto Fin;
	    }
	}

      found = false;
      dfs(0,0,0,0,dices);
      cout << (found?"YES":"NO") << endl;
    }
 Fin:;
  return 0;
}