#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, k;
int p[6][6][4] = {{{1, 6, 3, 8},
                   {5, 10, 7, 12},
                   {9, 21, 11, 23},
                   {13, 14, 15, 16},
                   {17, 18, 19, 20},
                   {22, 2, 24, 4}},
                  {{5, 2, 7, 4},
                   {9, 6, 11, 8},
                   {22, 10, 24, 12},
                   {13, 14, 15, 16},
                   {17, 18, 19, 20},
                   {1, 21, 3, 23}},
                  {{1, 2, 3, 4},
                   {17, 18, 7, 8},
                   {9, 10, 11, 12},
                   {5, 6, 15, 16},
                   {21, 22, 19, 20},
                   {13, 14, 23, 24}},
                  {{1, 2, 3, 4},
                   {13, 14, 7, 8},
                   {9, 10, 11, 12},
                   {21, 22, 15, 16},
                   {5, 6, 19, 20},
                   {17, 18, 23, 24}},
                  {{1, 2, 17, 19},
                   {5, 6, 7, 8},
                   {16, 14, 11, 12},
                   {13, 4, 15, 3},
                   {10, 18, 9, 20},
                   {21, 22, 23, 24}},
                  {{1, 2, 16, 14},
                   {5, 6, 7, 8},
                   {17, 19, 11, 12},
                   {13, 10, 15, 9},
                   {4, 18, 3, 20},
                   {21, 22, 23, 24}}};
int a[25];
int main() {
  for (int i = 1; i < 25; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 6; i++) {
    bool ok = 1;
    for (int j = 0; j < 6; j++) {
      int c = a[p[i][j][0]];
      for (int o = 0; o < 4; o++) {
        if (a[p[i][j][o]] != c) {
          ok = 0;
        }
      }
    }
    if (ok) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
}
