#include <bits/stdc++.h>
using namespace std;
int a[99];
bool check() {
  for (int i = 0; i < 24; i++) {
    if (i % 4 == 0) continue;
    if (a[i] != a[i - 1]) return 0;
  }
  return 1;
}
void F() {
  int x = a[2], y = a[3];
  a[2] = a[15];
  a[3] = a[13];
  a[13] = a[8];
  a[15] = a[9];
  a[8] = a[18];
  a[9] = a[16];
  a[16] = x;
  a[18] = y;
}
void B() {
  int x = a[0], y = a[1];
  a[0] = a[14];
  a[1] = a[12];
  a[12] = a[10];
  a[14] = a[11];
  a[10] = a[19];
  a[11] = a[17];
  a[17] = x;
  a[19] = y;
}
void U() {
  int x = a[12], y = a[13];
  a[12] = a[20];
  a[13] = a[21];
  a[20] = a[16];
  a[21] = a[17];
  a[16] = a[4];
  a[17] = a[5];
  a[4] = x;
  a[5] = y;
}
void D() {
  int x = a[14], y = a[15];
  a[14] = a[22];
  a[15] = a[23];
  a[22] = a[18];
  a[23] = a[19];
  a[18] = a[6];
  a[19] = a[7];
  a[6] = x;
  a[7] = y;
}
void L() {
  int x = a[0], y = a[2];
  a[0] = a[23];
  a[2] = a[21];
  a[23] = a[8];
  a[21] = a[10];
  a[8] = a[4];
  a[10] = a[6];
  a[4] = x;
  a[6] = y;
}
void R() {
  int x = a[1], y = a[3];
  a[1] = a[22];
  a[3] = a[20];
  a[22] = a[9];
  a[20] = a[11];
  a[9] = a[5];
  a[11] = a[7];
  a[5] = x;
  a[7] = y;
}
bool solve() {
  U();
  if (check()) return 1;
  U();
  U();
  if (check()) return 1;
  U();
  F();
  if (check()) return 1;
  F();
  F();
  if (check()) return 1;
  F();
  D();
  if (check()) return 1;
  D();
  D();
  if (check()) return 1;
  D();
  B();
  if (check()) return 1;
  B();
  B();
  if (check()) return 1;
  B();
  L();
  if (check()) return 1;
  L();
  L();
  if (check()) return 1;
  L();
  R();
  if (check()) return 1;
  R();
  R();
  if (check()) return 1;
  R();
  return 0;
}
int main() {
  for (int i = 0; i < 24; i++) scanf("%d", &a[i]);
  if (solve())
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
