#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);

string DiceRotX( string s, int t = 1 ) {
    string res = s;
    const int di[6] = { 1, 5, 2, 3, 0, 4 };
    for ( int k = 0; k < t; ++ k ) {
        for ( int i = 0; i < 6; ++ i ) {
            res[di[i]] = s[i];
        }
    }
    return res;
}

string DiceRotY( string s, int t = 1 ) {
    string res = s;
    const int di[6] = { 0, 3, 1, 4, 2, 5 };
    for ( int k = 0; k < t; ++ k ) {
        for ( int i = 0; i < 6; ++ i ) {
            res[di[i]] = s[i];
        }
    }
    return res;
}

string DiceRotZ( string s, int t = 1 ) {
    string res = s;
    const int di[6] = { 3, 1, 0, 5, 4, 2 };
    for ( int k = 0; k < t; ++ k ) {
        for ( int i = 0; i < 6; ++ i ) {
            res[di[i]] = s[i];
        }
    }
    return res;
}

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

bool dfs( int depth, int state ) {
    if ( depth == 0 ) {
        for ( int u = 0; u < 8; ++ u ) {
            int bu = 1 << u;
            if ( ( state & bu ) != 0 ) continue;
            for ( int i = 0; i < 6; ++ i ) {
                for ( int j = 0; j < 6; ++ j ) {
                    for ( int k = 0; k < 6; ++ k ) {
                        string s = L[u];
                        s = DiceRotX( s, i );
                        s = DiceRotY( s, j );
                        s = DiceRotZ( s, k );
                        R[1] = s;
                        if ( check( R[0][2], R[1][3] ) ) {
                            if ( dfs( depth + 1, state | bu ) ) return true;
                        }
                    }
                }
            }
        }
    } else if ( depth == 1 ) {
        for ( int u = 0; u < 8; ++ u ) {
            int bu = 1 << u;
            if ( ( state & bu ) != 0 ) continue;
            for ( int i = 0; i < 6; ++ i ) {
                for ( int j = 0; j < 6; ++ j ) {
                    for ( int k = 0; k < 6; ++ k ) {
                        string s = L[u];
                        s = DiceRotX( s, i );
                        s = DiceRotY( s, j );
                        s = DiceRotZ( s, k );
                        R[2] = s;
                        if ( check( R[0][1], R[2][5] ) ) {
                            if ( dfs( depth + 1, state | bu ) ) return true;
                        }
                    }
                }
            }
        }
    } else if ( depth == 2 ) {
        for ( int u = 0; u < 8; ++ u ) {
            int bu = 1 << u;
            if ( ( state & bu ) != 0 ) continue;
            for ( int i = 0; i < 6; ++ i ) {
                for ( int j = 0; j < 6; ++ j ) {
                    for ( int k = 0; k < 6; ++ k ) {
                        string s = L[u];
                        s = DiceRotX( s, i );
                        s = DiceRotY( s, j );
                        s = DiceRotZ( s, k );
                        R[3] = s;
                        if ( check( R[1][5], R[3][1] ) && check( R[2][2], R[3][4] ) ) {
                            if ( dfs( depth + 1, state | bu ) ) return true;
                        }
                    }
                }
            }
        }
    } else if ( depth == 3 ) {
        for ( int u = 0; u < 8; ++ u ) {
            int bu = 1 << u;
            if ( ( state & bu ) != 0 ) continue;
            for ( int i = 0; i < 6; ++ i ) {
                for ( int j = 0; j < 6; ++ j ) {
                    for ( int k = 0; k < 6; ++ k ) {
                        string s = L[u];
                        s = DiceRotX( s, i );
                        s = DiceRotY( s, j );
                        s = DiceRotZ( s, k );
                        R[4] = s;
                        if ( check( R[4][1], R[0][4] ) ) {
                            if ( dfs( depth + 1, state | bu ) ) return true;
                        }
                    }
                }
            }
        }
    } else if ( depth == 4 ) {
        for ( int u = 0; u < 8; ++ u ) {
            int bu = 1 << u;
            if ( ( state & bu ) != 0 ) continue;
            for ( int i = 0; i < 6; ++ i ) {
                for ( int j = 0; j < 6; ++ j ) {
                    for ( int k = 0; k < 6; ++ k ) {
                        string s = L[u];
                        s = DiceRotX( s, i );
                        s = DiceRotY( s, j );
                        s = DiceRotZ( s, k );
                        R[5] = s;
                        if ( check( R[5][1], R[1][4] ) && check( R[5][3], R[4][2] ) ) {
                            if ( dfs( depth + 1, state | bu ) ) return true;
                        }
                    }
                }
            }
        }
    } else if ( depth == 5 ) {
        for ( int u = 0; u < 8; ++ u ) {
            int bu = 1 << u;
            if ( ( state & bu ) != 0 ) continue;
            for ( int i = 0; i < 6; ++ i ) {
                for ( int j = 0; j < 6; ++ j ) {
                    for ( int k = 0; k < 6; ++ k ) {
                        string s = L[u];
                        s = DiceRotX( s, i );
                        s = DiceRotY( s, j );
                        s = DiceRotZ( s, k );
                        R[6] = s;
                        if ( check( R[6][0], R[2][4] ) && check( R[6][0], R[4][5] ) ) {
                            if ( dfs( depth + 1, state | bu ) ) return true;
                        }
                    }
                }
            }
        }
    } else if ( depth == 6 ) {
        for ( int u = 0; u < 8; ++ u ) {
            int bu = 1 << u;
            if ( ( state & bu ) != 0 ) continue;
            for ( int i = 0; i < 6; ++ i ) {
                for ( int j = 0; j < 6; ++ j ) {
                    for ( int k = 0; k < 6; ++ k ) {
                        string s = L[u];
                        s = DiceRotX( s, i );
                        s = DiceRotY( s, j );
                        s = DiceRotZ( s, k );
                        R[7] = s;
                        if ( check( R[7][0], R[3][4] ) && check( R[7][0], R[5][5] ) ) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}

bool solve() {
    for ( int start = 0; start < 8; ++ start ) {
        for ( int i = 0; i < 6; ++ i ) {
            for ( int j = 0; j < 6; ++ j ) {
                for ( int k = 0; k < 6; ++ k ) {
                    string s = L[start];
                    s = DiceRotX( s, i );
                    s = DiceRotY( s, j );
                    s = DiceRotZ( s, k );
                    R[0] = s;
                    if ( dfs( 0, 1<<start ) ) return true;
                }
            }
        }
    }
    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];
        cout << ( solve() ? "YES" : "NO" ) << endl;
    }
    return 0;
}