#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    using P = array<int, 6>;
    vector<P> ps{{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}};
    vector<string> v(8);
    while(cin >> v[0], v[0] != "0") {
        for (int i = 1; i < 8; ++i) cin >> v[i];
        vector<vector<string>> vv(8);
        array<char, 256> p;
        for (int i = 'a'; i <= 'z'; ++i) {
            p[i] = i-'a'+'A';
            p[i-'a'+'A'] = i;
        }
        for (int i = 0; i < 8; ++i) {
            for (int j = 0; j < ps.size(); ++j) {
                string a(6, ' ');
                for (int k = 0; k < 6; ++k) {
                    a[k] = v[i][ps[j][k]];
                }
                vv[i].emplace_back(a);
            }
        }
        vector<string> ans;
        vector<int> selected(8, 0);

        auto f = [&](int cur, auto &&f) -> bool {
            if (cur == 8) return true;
            for (int i = 0; i < 8; ++i) {
                if (!selected[i]){
                    selected[i] = 1;
                    for (int j = 0; j < ps.size(); ++j) {
                        int ok = 1;
                        if(cur&1){
                            if(p[ans[cur^1][1]] != vv[i][j][4]) ok = 0;
                        }
                        if(cur & 2){
                            if(p[ans[cur^2][3]] != vv[i][j][2]) ok = 0;
                        }
                        if(cur & 4){
                            if(p[ans[cur^4][0]] != vv[i][j][5]) ok = 0;
                        }
                        if(ok){
                            ans.emplace_back(vv[i][j]);
                            if(f(cur+1, f)) return true;
                            ans.pop_back();
                        }
                    }
                    selected[i] = 0;
                }
            }
            return false;
        };
        puts(f(0, f) ? "YES" : "NO");
    }
    return 0;

}
