#include <bits/stdc++.h>
using namespace std;
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T min(T a, T b, T c, T d) {
  return min(a, min(b, min(c, d)));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
T max(T a, T b, T c, T d) {
  return max(a, max(b, max(c, d)));
}
bool cmp(const pair<int, int>& a, const pair<int, int>& b) {
  return (a.first > b.first || (a.first == b.first && a.second >= b.second));
}
long long GCD(long long a, long long b) { return (a % b) ? GCD(b, a % b) : b; }
int a[30];
int b[] = {0, 1, 13, 5, 17, 21, 9};
bool sameAll() {
  for (int i = (1); i <= (6); ++i) {
    set<int> st;
    for (int j = (0); j <= (3); ++j) st.insert(a[b[i] + j]);
    if (st.size() != 1) return 0;
  }
  return 1;
}
bool same(int n) {
  set<int> st;
  for (int i = (0); i <= (3); ++i) st.insert(a[b[n] + i]);
  return st.size() == 1;
}
void rot(int x) {
  if (x == 1) {
    int x = a[b[1]];
    int y = a[b[1] + 2];
    a[b[1]] = a[b[3]];
    a[b[1] + 2] = a[b[3] + 2];
    a[b[3]] = a[b[6]];
    a[b[3] + 2] = a[b[6] + 2];
    a[b[6]] = a[b[5] + 1];
    a[b[6] + 2] = a[b[5] + 3];
    a[b[5] + 1] = x;
    a[b[5] + 3] = y;
  }
  if (x == 2) {
    int x = a[b[5] + 1];
    int y = a[b[5] + 3];
    a[b[5] + 1] = a[b[6]];
    a[b[5] + 3] = a[b[6] + 2];
    a[b[6]] = a[b[3]];
    a[b[6] + 2] = a[b[3] + 2];
    a[b[3]] = a[b[1]];
    a[b[3] + 2] = a[b[1] + 2];
    a[b[1]] = x;
    a[b[1] + 2] = y;
  }
  if (x == 3) {
    int x = a[b[2]];
    int y = a[b[2] + 1];
    a[b[2]] = a[b[3]];
    a[b[2] + 1] = a[b[3] + 1];
    a[b[3]] = a[b[4]];
    a[b[3] + 1] = a[b[4] + 1];
    a[b[4]] = a[b[5]];
    a[b[4] + 1] = a[b[5] + 1];
    a[b[5]] = x;
    a[b[5] + 1] = y;
  }
  if (x == 4) {
    int x = a[b[2]];
    int y = a[b[2] + 1];
    a[b[2]] = a[b[5]];
    a[b[2] + 1] = a[b[5] + 1];
    a[b[5]] = a[b[4]];
    a[b[5] + 1] = a[b[4] + 1];
    a[b[4]] = a[b[3]];
    a[b[4] + 1] = a[b[3] + 1];
    a[b[3]] = x;
    a[b[3] + 1] = y;
  }
  if (x == 5) {
    int x = a[b[1]];
    int y = a[b[1] + 1];
    a[b[1]] = a[b[2] + 2];
    a[b[1] + 1] = a[b[2]];
    a[b[2] + 2] = a[b[6] + 3];
    a[b[2]] = a[b[6] + 2];
    a[b[6] + 3] = a[b[4] + 1];
    a[b[6] + 2] = a[b[4] + 3];
    a[b[4] + 1] = x;
    a[b[4] + 3] = y;
  }
  if (x == 6) {
    int x = a[b[1]];
    int y = a[b[1] + 1];
    a[b[1]] = a[b[4] + 1];
    a[b[1] + 1] = a[b[4] + 3];
    a[b[4] + 1] = a[b[6] + 3];
    a[b[4] + 3] = a[b[6] + 2];
    a[b[6] + 3] = a[b[2] + 2];
    a[b[6] + 2] = a[b[2]];
    a[b[2] + 2] = x;
    a[b[2]] = y;
  }
  return;
}
int main() {
  for (int i = (1); i <= (24); ++i) scanf("%d", &a[i]);
  if (same(2) && same(4)) {
    rot(1);
    if (sameAll()) {
      puts("YES");
      return 0;
    }
    rot(2);
    rot(2);
    if (sameAll()) {
      puts("YES");
      return 0;
    }
  }
  if (same(1) && same(6)) {
    rot(3);
    if (sameAll()) {
      puts("YES");
      return 0;
    }
    rot(4);
    rot(4);
    if (sameAll()) {
      puts("YES");
      return 0;
    }
  }
  if (same(3) && same(5)) {
    rot(5);
    if (sameAll()) {
      puts("YES");
      return 0;
    }
    rot(6);
    rot(6);
    if (sameAll()) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
