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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
string s[8];
vector<vector<int> > rot;
void do_rotate(vector<int>& v, int a, int b, int c, int d){
  int t = v[a];
  v[a] = v[b]; v[b] = v[c]; v[c] = v[d]; v[d] = t;
}
void make_rot(){
  vector<int> v(6);
  REP(i, 6) v[i] = i;
  for(int k = 0; k < 6; k++){
    if(k % 2 == 0) do_rotate(v, 0, 2, 5, 3);
    else do_rotate(v, 0, 1, 5, 4);
    for(int l = 0; l < 4; l++){
      do_rotate(v, 1, 2, 4, 3);
      rot.push_back(v);
    }
  }
}
bool used[8];
int d_id[8];
int r_id[8];
// {id1, id2, r1, r2}
int RULE[12][4] = {
  {0, 1, 2, 3},
  {0, 2, 1, 4},
  {0, 4, 5, 0},
  {1, 3, 1, 4},
  {1, 5, 5, 0},
  {2, 3, 2, 3},
  {2, 6, 5, 0},
  {3, 7, 5, 0},
  {4, 5, 2, 3},
  {4, 6, 1, 4},
  {5, 7, 1, 4},
  {6, 7, 2, 3}
};
vector<int> id1[8];
vector<int> id2[8];
vector<int> r1[8];
vector<int> r2[8];
void make_rule(){
  for(int i = 0; i < 12; i++){
    int x = RULE[i][1];
    id1[x].push_back(RULE[i][0]);
    id2[x].push_back(RULE[i][1]);
    r1[x].push_back(RULE[i][2]);
    r2[x].push_back(RULE[i][3]);
  }
}
bool match(char c, char d){
  if(c > d) swap(c, d);
  return c - 'A' + 'a' == d;
}
bool dfs(int k){
  if(k == 8) return true;
  for(int i = 0; i < 8; i++) if(!used[i]){
    used[i] = true;
    d_id[k] = i;
    for(int j = 0; j < 24; j++){
      r_id[k] = j;
      bool ok = true;
      for(int i = 0; i < id1[k].size(); i++){
        char c1 = s[d_id[id1[k][i]]][rot[r_id[id1[k][i]]][r1[k][i]]];
        char c2 = s[d_id[id2[k][i]]][rot[r_id[id2[k][i]]][r2[k][i]]];
        if(!match(c1, c2)){
          ok = false;
          break;
        }
      }
      if(ok && dfs(k + 1)) return true;
    }
    used[i] = false;
  }
  return false;
}
int main(){
  make_rot();
  make_rule();
  while(true){
    REP(i, 8) cin >> s[i];
    if(cin.eof()) break;
    memset(used, 0, sizeof used);
    memset(d_id, 0, sizeof d_id);
    memset(r_id, 0, sizeof r_id);
    if(dfs(0)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}