#include <bits/stdc++.h>
using namespace std;
int main() {
  string r[12] = {"111155223333224466554466", "111144223333664422555566",
                  "114422225533434315156666", "115522224433414135356666",
                  "111122553333442255666644", "111122443333446655226655",
                  "212132326363444455556161", "616112122323444455556363",
                  "121223233636444455551616", "161621213232444455553636",
                  "551122223344141453536666", "441122223355343451516666"};
  vector<int> v(24);
  for (int i = 0; i < 24; ++i) cin >> v[i];
  for (auto b : r) {
    bool correct = true;
    for (int i = 0; i < 24; ++i)
      for (int j = 0; j < 24; ++j)
        if ((b[i] == b[j] && v[i] != v[j]) || (v[i] == v[j] && b[i] != b[j]))
          correct = false;
    if (correct) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
