#include <bits/stdc++.h>
using namespace std;
int N = 24;
int arr[25];
bool correct(int a, int b, int c, int d) {
  if (arr[a] == arr[b] && arr[b] == arr[c] && arr[c] == arr[d]) return true;
  return false;
}
int main() {
  for (int n = 1; n <= N; n++) scanf("%d", &arr[n]);
  if (correct(1, 2, 3, 4) && correct(9, 10, 11, 12)) {
    if ((correct(5, 6, 15, 16) && correct(17, 18, 7, 8) &&
         correct(21, 22, 19, 20) && correct(13, 14, 23, 24)) ||
        (correct(13, 14, 7, 8) && correct(5, 6, 19, 20) &&
         correct(17, 18, 23, 24) && correct(21, 22, 15, 16)))
      printf("YES\n");
    else
      printf("NO\n");
  } else if (correct(5, 6, 7, 8) && correct(21, 22, 23, 24)) {
    if ((correct(1, 2, 17, 19) && correct(18, 20, 9, 10) &&
         correct(11, 12, 14, 16) && correct(13, 15, 3, 4)) ||
        (correct(1, 2, 14, 16) && correct(18, 20, 3, 4) &&
         correct(11, 12, 17, 19) && correct(13, 15, 9, 10)))
      printf("YES\n");
    else
      printf("NO\n");
  } else if (correct(13, 14, 15, 16) && correct(17, 18, 19, 20)) {
    if ((correct(1, 3, 6, 8) && correct(2, 4, 22, 24) &&
         correct(5, 7, 10, 12) && correct(9, 11, 21, 23)) ||
        (correct(5, 7, 2, 4) && correct(9, 11, 6, 8) && correct(1, 3, 21, 23) &&
         correct(22, 24, 10, 12)))
      printf("YES\n");
    else
      printf("NO\n");
  } else
    printf("NO\n");
  return 0;
}
