#include <bits/stdc++.h>
using namespace std;
int main() {
  int ar[20], i;
  for (i = 1; i <= 16; i++) cin >> ar[i];
  if (ar[4] == 1) {
    if (ar[1] == 1 || ar[2] == 1 || ar[3] == 1 || ar[5] == 1 || ar[10] == 1 ||
        ar[15] == 1) {
      cout << "YES" << endl;
      return 0;
    }
  }
  if (ar[8] == 1) {
    if (ar[3] == 1 || ar[5] == 1 || ar[6] == 1 || ar[7] == 1 || ar[9] == 1 ||
        ar[14] == 1) {
      cout << "YES" << endl;
      return 0;
    }
  }
  if (ar[12] == 1) {
    if (ar[2] == 1 || ar[9] == 1 || ar[10] == 1 || ar[7] == 1 || ar[11] == 1 ||
        ar[13] == 1) {
      cout << "YES" << endl;
      return 0;
    }
  }
  if (ar[16] == 1) {
    if (ar[1] == 1 || ar[6] == 1 || ar[15] == 1 || ar[14] == 1 || ar[11] == 1 ||
        ar[13] == 1) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}
