#include <bits/stdc++.h>
using namespace std;
int a[100];
int b[100];
bool check() {
  for (int i = 0; i < 6; i++) {
    for (int j = i * 4 + 2; j <= (i + 1) * 4; j++) {
      if (b[j] != b[j - 1]) return 0;
    }
  }
  return 1;
}
int main() {
  int n, i, j, k, t, m;
  int seq[100][100] = {
      {2, 4, 6, 8, 10, 12, 23, 21},   {1, 3, 5, 7, 9, 11, 24, 22},
      {15, 16, 7, 8, 19, 20, 23, 24}, {13, 14, 5, 6, 17, 18, 21, 22},
      {21, 23, 12, 10, 8, 6, 4, 2},   {22, 24, 11, 9, 7, 5, 3, 1},
      {24, 23, 20, 19, 8, 7, 16, 15}, {22, 21, 18, 17, 6, 5, 14, 13},
      {16, 14, 3, 4, 17, 19, 10, 9},  {9, 10, 19, 17, 4, 3, 14, 16},
      {15, 13, 1, 2, 18, 20, 12, 11}, {11, 12, 20, 18, 2, 1, 13, 15}};
  for (i = 1; i < 25; i++) {
    cin >> a[i];
  }
  for (j = 0; j < 12; j++) {
    for (i = 1; i < 25; i++) {
      b[i] = a[i];
    }
    int ls1 = b[seq[j][6]], ls2 = b[seq[j][7]], ls3, ls4;
    for (k = 0; k < 8; k += 2) {
      ls3 = b[seq[j][k]];
      ls4 = b[seq[j][k + 1]];
      b[seq[j][k]] = ls1;
      b[seq[j][k + 1]] = ls2;
      ls1 = ls3;
      ls2 = ls4;
    }
    if (check()) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
