#include <bits/stdc++.h>
using namespace std;
int a[25];
bool check_f(int A, int B, int C, int D) {
  if (a[A] == a[B] && a[B] == a[C] && a[C] == a[D]) return true;
  return false;
}
bool check_solved() {
  for (int i = 1; i <= 24; i += 4) {
    if (check_f(i, i + 1, i + 2, i + 3) == false) return false;
  }
  return true;
}
int main() {
  for (int i = 1; i <= 24; i++) cin >> a[i];
  int ans = 0;
  if (check_f(3, 4, 18, 20) && check_f(17, 19, 11, 12) &&
      check_f(9, 10, 13, 15) && check_f(14, 16, 1, 2) && check_f(5, 6, 7, 8) &&
      check_f(21, 22, 23, 24))
    ans = 1;
  else if (check_f(9, 10, 18, 20) && check_f(17, 19, 1, 2) &&
           check_f(3, 4, 13, 15) && check_f(14, 16, 11, 12) &&
           check_f(5, 6, 7, 8) && check_f(21, 22, 23, 24))
    ans = 1;
  else if (check_f(2, 4, 22, 24) && check_f(21, 23, 9, 11) &&
           check_f(5, 7, 10, 12) && check_f(1, 3, 6, 8) &&
           check_f(17, 18, 19, 20) && check_f(13, 14, 15, 16))
    ans = 1;
  else if (check_f(2, 4, 5, 7) && check_f(21, 23, 1, 3) &&
           check_f(10, 12, 22, 24) && check_f(9, 11, 6, 8) &&
           check_f(17, 18, 19, 20) && check_f(13, 14, 15, 16))
    ans = 1;
  else if (check_f(18, 20, 3, 4) && check_f(1, 2, 14, 16) &&
           check_f(13, 15, 9, 10) && check_f(11, 12, 17, 19) &&
           check_f(5, 6, 7, 8) && check_f(21, 22, 23, 24))
    ans = 1;
  else if (check_f(18, 20, 9, 10) && check_f(1, 2, 17, 19) &&
           check_f(13, 15, 3, 4) && check_f(11, 12, 14, 16) &&
           check_f(5, 6, 7, 8) && check_f(21, 22, 23, 24))
    ans = 1;
  else if (check_f(1, 3, 6, 8) && check_f(5, 7, 10, 12) &&
           check_f(9, 11, 21, 23) && check_f(22, 24, 2, 4) &&
           check_f(17, 18, 19, 20) && check_f(13, 14, 15, 16))
    ans = 1;
  else if (check_f(1, 3, 21, 23) && check_f(5, 7, 2, 4) &&
           check_f(9, 11, 6, 8) && check_f(22, 24, 10, 12) &&
           check_f(17, 18, 19, 20) && check_f(13, 14, 15, 16))
    ans = 1;
  else if (check_f(5, 6, 15, 16) && check_f(13, 14, 23, 24) &&
           check_f(17, 18, 7, 8) && check_f(21, 22, 19, 20) &&
           check_f(9, 10, 11, 12) && check_f(1, 2, 3, 4))
    ans = 1;
  else if (check_f(5, 6, 19, 20) && check_f(13, 14, 7, 8) &&
           check_f(17, 18, 23, 24) && check_f(21, 22, 15, 16) &&
           check_f(9, 10, 11, 12) && check_f(1, 2, 3, 4))
    ans = 1;
  else if (check_f(15, 16, 5, 6) && check_f(17, 18, 7, 8) &&
           check_f(19, 20, 21, 22) && check_f(23, 24, 13, 14) &&
           check_f(1, 2, 3, 4) && check_f(9, 10, 11, 12))
    ans = 1;
  else if (check_f(5, 6, 19, 20) && check_f(17, 18, 23, 24) &&
           check_f(15, 16, 21, 22) && check_f(7, 8, 13, 14) &&
           check_f(1, 2, 3, 4) && check_f(9, 10, 11, 12))
    ans = 1;
  if (ans)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
