#include <bits/stdc++.h>
using namespace std;
long long int a[30];
long long int first(long long int p, long long int q, long long int r,
                    long long int second) {
  if (a[p] == a[q] && a[q] == a[r] && a[r] == a[second]) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, possible;
  possible = 0;
  for (i = 1; i <= 24; i++) cin >> a[i];
  if (first(1, 2, 3, 4) && first(9, 10, 11, 12) && first(13, 14, 7, 8) &&
      first(5, 6, 19, 20) && first(17, 18, 23, 24) && first(21, 22, 15, 16))
    possible = 1;
  if (first(1, 2, 3, 4) && first(9, 10, 11, 12) && first(13, 14, 23, 24) &&
      first(5, 6, 15, 16) && first(17, 18, 7, 8) && first(21, 22, 19, 20))
    possible = 1;
  if (first(5, 6, 7, 8) && first(21, 22, 23, 24) && first(3, 4, 18, 20) &&
      first(17, 19, 11, 12) && first(9, 10, 13, 15) && first(14, 16, 1, 2))
    possible = 1;
  if (first(5, 6, 7, 8) && first(21, 22, 23, 24) && first(3, 4, 13, 15) &&
      first(17, 19, 1, 2) && first(9, 10, 18, 20) && first(14, 16, 11, 12))
    possible = 1;
  if (first(13, 14, 15, 16) && first(17, 18, 19, 20) && first(1, 3, 6, 8) &&
      first(5, 7, 10, 12) && first(9, 11, 21, 23) && first(22, 24, 2, 4))
    possible = 1;
  if (first(13, 14, 15, 16) && first(17, 18, 19, 20) && first(1, 3, 21, 23) &&
      first(5, 7, 2, 4) && first(9, 11, 6, 8) && first(22, 24, 10, 12))
    possible = 1;
  if (possible)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
