#include <bits/stdc++.h>
using namespace std;
long long ar[26];
bool fun(long long a, long long b, long long c, long long d) {
  if (ar[a] == ar[b] && ar[b] == ar[c] && ar[c] == ar[d] && ar[d] == ar[a])
    return true;
  else
    return false;
}
int main() {
  for (long long i = 1; i <= 24; i++) scanf("%lld", &ar[i]);
  bool ans = false;
  if (fun(5, 7, 2, 4) && fun(1, 3, 21, 23) && fun(9, 11, 6, 8) &&
      fun(22, 24, 10, 12) && fun(13, 14, 15, 16) && fun(17, 18, 19, 20))
    ans = true;
  if (fun(1, 3, 6, 8) && fun(22, 24, 2, 4) && fun(5, 7, 10, 12) &&
      fun(9, 11, 21, 23) && fun(13, 14, 15, 16) && fun(17, 18, 19, 20))
    ans = true;
  if (fun(21, 23, 1, 3) && fun(2, 4, 5, 7) && fun(9, 11, 6, 8) &&
      fun(22, 24, 10, 12) && fun(13, 14, 15, 16) && fun(17, 18, 19, 20))
    ans = true;
  if (fun(2, 4, 22, 24) && fun(6, 8, 1, 3) && fun(10, 12, 5, 7) &&
      fun(9, 11, 21, 23) && fun(13, 14, 15, 16) && fun(17, 18, 19, 20))
    ans = true;
  if (fun(21, 22, 15, 16) && fun(13, 14, 7, 8) && fun(5, 6, 19, 20) &&
      fun(17, 18, 23, 24) && fun(1, 2, 3, 4) && fun(9, 10, 11, 12))
    ans = true;
  if (fun(13, 14, 23, 24) && fun(5, 6, 15, 16) && fun(17, 18, 7, 8) &&
      fun(21, 22, 19, 20) && fun(1, 2, 3, 4) && fun(9, 10, 11, 12))
    ans = true;
  if (fun(23, 24, 13, 14) && fun(15, 16, 5, 6) && fun(7, 8, 17, 18) &&
      fun(19, 20, 21, 22) && fun(1, 2, 3, 4) && fun(9, 10, 11, 12))
    ans = true;
  if (fun(15, 16, 21, 22) && fun(7, 8, 13, 14) && fun(19, 20, 5, 6) &&
      fun(23, 24, 17, 18) && fun(1, 2, 3, 4) && fun(9, 10, 11, 12))
    ans = true;
  if (fun(3, 4, 18, 20) && fun(17, 19, 11, 12) && fun(9, 10, 13, 15) &&
      fun(14, 16, 1, 2) && fun(5, 6, 7, 8) && fun(21, 22, 23, 24))
    ans = true;
  if (fun(3, 4, 13, 15) && fun(14, 16, 11, 12) && fun(9, 10, 18, 20) &&
      fun(17, 19, 1, 2) && fun(5, 6, 7, 8) && fun(21, 22, 23, 24))
    ans = true;
  if (fun(1, 2, 14, 16) && fun(15, 13, 9, 10) && fun(11, 12, 17, 19) &&
      fun(18, 20, 3, 4) && fun(5, 6, 7, 8) && fun(21, 22, 23, 24))
    ans = true;
  if (fun(1, 2, 17, 19) && fun(18, 20, 9, 10) && fun(11, 12, 14, 16) &&
      fun(13, 15, 3, 4) && fun(5, 6, 7, 8) && fun(21, 22, 23, 24))
    ans = true;
  if (ans)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
