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