#include <bits/stdc++.h>
using namespace std;
int a[30];
bool f(int x, int y, int z, int w) {
  return a[x] == a[y] && a[y] == a[z] && a[z] == a[w];
}
bool check() {
  if (f(5, 6, 7, 8) && f(21, 22, 23, 24) && f(11, 12, 14, 16) &&
      f(20, 18, 9, 10) && f(1, 2, 19, 17) && f(15, 13, 3, 4))
    return true;
  if (f(5, 6, 7, 8) && f(21, 22, 23, 24) && f(11, 12, 19, 17) &&
      f(20, 18, 3, 4) && f(1, 2, 14, 16) && f(15, 13, 9, 10))
    return true;
  if (f(9, 10, 11, 12) && f(1, 2, 3, 4) && f(5, 6, 15, 16) && f(17, 18, 7, 8) &&
      f(22, 21, 19, 20) && f(14, 13, 24, 23))
    return true;
  if (f(9, 10, 11, 12) && f(1, 2, 3, 4) && f(5, 6, 19, 20) &&
      f(17, 18, 24, 23) && f(22, 21, 15, 16) && f(14, 13, 7, 8))
    return true;
  if (f(13, 14, 15, 16) && f(17, 18, 19, 20) && f(5, 7, 2, 4) &&
      f(1, 3, 21, 23) && f(22, 24, 10, 12) && f(9, 11, 6, 8))
    return true;
  if (f(13, 14, 15, 16) && f(17, 18, 19, 20) && f(5, 7, 10, 12) &&
      f(1, 3, 6, 8) && f(22, 24, 2, 4) && f(9, 11, 21, 23))
    return true;
  return false;
}
int main() {
  for (int i = 1; i <= 24; ++i) cin >> a[i];
  if (check())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
