#include <bits/stdc++.h>
using namespace std;
int a[7][4];
bool check(int idx) {
  if (a[idx][0] == a[idx][1] && a[idx][1] == a[idx][2] &&
      a[idx][2] == a[idx][3]) {
    return true;
  } else {
    return false;
  }
}
bool sequence(int i, int x, int y, int j, int z, int w) {
  if ((a[i][x] == a[i][y] && a[i][x] == a[j][z] && a[i][x] == a[j][w])) {
    return true;
  } else {
    return false;
  }
}
int main() {
  for (int i = 1; i < 7; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> a[i][j];
    }
  }
  bool result = false;
  if (check(4) && check(5)) {
    if (sequence(1, 1, 3, 2, 0, 2) && sequence(2, 1, 3, 3, 0, 2) &&
        sequence(3, 1, 3, 6, 1, 3) && sequence(6, 0, 2, 1, 0, 2)) {
      result = true;
    }
    if (sequence(1, 0, 2, 2, 1, 3) && sequence(2, 0, 2, 3, 1, 3) &&
        sequence(3, 0, 2, 6, 0, 2) && sequence(6, 1, 3, 1, 1, 3)) {
      result = true;
    }
  }
  if (check(1) && check(3)) {
    if (sequence(4, 0, 1, 2, 2, 3) && sequence(2, 0, 1, 5, 2, 3) &&
        sequence(5, 0, 1, 6, 2, 3) && sequence(6, 0, 1, 4, 2, 3)) {
      result = true;
    }
    if (sequence(4, 0, 1, 6, 2, 3) && sequence(2, 0, 1, 4, 2, 3) &&
        sequence(5, 0, 1, 2, 2, 3) && sequence(6, 0, 1, 5, 2, 3)) {
      result = true;
    }
  }
  if (check(2) && check(6)) {
    if (sequence(1, 2, 3, 5, 1, 3) && sequence(5, 0, 2, 3, 2, 3) &&
        sequence(3, 0, 1, 4, 0, 2) && sequence(4, 1, 3, 1, 0, 1)) {
      result = true;
    }
    if (sequence(1, 2, 3, 4, 0, 2) && sequence(4, 1, 3, 3, 2, 3) &&
        sequence(3, 0, 1, 5, 1, 3) && sequence(5, 0, 2, 1, 0, 1)) {
      result = true;
    }
  }
  if (result) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
