#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


VS R(8);
VS L(8);
bool used[8];

const int DI[24][6] = {
    { 0,1,2,3,4,5 }, { 0,2,4,1,3,5 }, { 0,3,1,4,2,5 }, { 0,4,3,2,1,5 },
    { 1,0,3,2,5,4 }, { 1,2,0,5,3,4 }, { 1,3,5,0,2,4 }, { 1,5,2,3,0,4 },
    { 2,0,1,4,5,3 }, { 2,1,5,0,4,3 }, { 2,4,0,5,1,3 }, { 2,5,4,1,0,3 },
    { 3,0,4,1,5,2 }, { 3,1,0,5,4,2 }, { 3,4,5,0,1,2 }, { 3,5,1,4,0,2 },
    { 4,0,2,3,5,1 }, { 4,2,5,0,3,1 }, { 4,3,0,5,2,1 }, { 4,5,3,2,0,1 },
    { 5,1,3,2,4,0 }, { 5,2,1,4,3,0 }, { 5,3,4,1,2,0 }, { 5,4,2,3,1,0 }
};

string DiceRot( string s, int t ) {
    string res = s;
    for ( int i = 0; i < 6; ++ i ) {
        res[DI[t][i]] = s[i];
    }
    return res;
}

bool check( char a, char b ) {
    return a != b && ( a & ~32 ) == ( b & ~32 );
}

bool dfs( int depth ) {
    if ( depth == 0 ) {
        for ( int u = 0; u < 8; ++ u ) {
            if ( used[u] ) continue;
            used[u] = true;
            for ( int i = 0; i < 24; ++ i ) {
                string s = L[u];
                s = DiceRot( s, i );
                R[1] = s;
                if ( check( R[0][2], R[1][3] ) ) {
                    if ( dfs( depth + 1 ) ) return true;
                }
            }
            used[u] = false;
        }
    } else if ( depth == 1 ) {
        for ( int u = 0; u < 8; ++ u ) {
            if ( used[u] ) continue;
            used[u] = true;
            for ( int i = 0; i < 24; ++ i ) {
                string s = L[u];
                s = DiceRot( s, i );
                R[2] = s;
                if ( check( R[0][5], R[2][0] ) ) {
                    if ( dfs( depth + 1 ) ) return true;
                }
            }
            used[u] = false;
        }
    } else if ( depth == 2 ) {
        for ( int u = 0; u < 8; ++ u ) {
            if ( used[u] ) continue;
            used[u] = true;
            for ( int i = 0; i < 24; ++ i ) {
                string s = L[u];
                s = DiceRot( s, i );
                R[3] = s;
                if ( check( R[1][5], R[3][0] ) && check( R[2][2], R[3][3] ) ) {
                    if ( dfs( depth + 1 ) ) return true;
                }
            }
            used[u] = false;
        }
    } else if ( depth == 3 ) {
        for ( int u = 0; u < 8; ++ u ) {
            if ( used[u] ) continue;
            used[u] = true;
            for ( int i = 0; i < 24; ++ i ) {
                string s = L[u];
                s = DiceRot( s, i );
                R[4] = s;
                if ( check( R[4][1], R[0][4] ) ) {
                    if ( dfs( depth + 1 ) ) return true;
                }
            }
            used[u] = false;
        }
    } else if ( depth == 4 ) {
        for ( int u = 0; u < 8; ++ u ) {
            if ( used[u] ) continue;
            used[u] = true;
            for ( int i = 0; i < 24; ++ i ) {
                string s = L[u];
                s = DiceRot( s, i );
                R[5] = s;
                if ( check( R[5][1], R[1][4] ) && check( R[5][3], R[4][2] ) ) {
                    if ( dfs( depth + 1 ) ) return true;
                }
            }
            used[u] = false;
        }
    } else if ( depth == 5 ) {
        for ( int u = 0; u < 8; ++ u ) {
            if ( used[u] ) continue;
            used[u] = true;
            for ( int i = 0; i < 24; ++ i ) {
                string s = L[u];
                s = DiceRot( s, i );
                R[6] = s;
                if ( check( R[6][1], R[2][4] ) && check( R[6][0], R[4][5] ) ) {
                    if ( dfs( depth + 1 ) ) return true;
                }
            }
            used[u] = false;
        }
    } else if ( depth == 6 ) {
        for ( int u = 0; u < 8; ++ u ) {
            if ( used[u] ) continue;
            used[u] = true;
            for ( int i = 0; i < 24; ++ i ) {
                string s = L[u];
                s = DiceRot( s, i );
                R[7] = s;
                if ( check( R[7][1], R[3][4] ) && check( R[7][0], R[5][5] ) && check( R[7][3], R[6][2] ) ) {
                    return true;
                }
                R[7] = "";
            }
            used[u] = false;
        }
    }
    return false;
}

bool solve() {
    for ( int start = 0; start < 8; ++ start ) {
        used[start] = true;
        for ( int i = 0; i < 24; ++ i ) {
            string s = L[start];
            s = DiceRot( s, i );
            R[0] = s;
            if ( dfs( 0 ) ) return true;
        }
        used[start] = false;
    }
    return false;
}

int main() {
    string line;
    while ( cin >> line ) {
        if ( line == "0" ) break;
        L[0] = line;
        for ( int i = 1; i < 8; ++ i ) cin >> L[i];
        fill( used, used+8, false );
        cout << ( solve() ? "YES" : "NO" ) << endl;
    }
    return 0;
}