#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4][4];
  int i, j;
  for (i = 0; i < 4; i++)
    for (j = 0; j < 4; j++) cin >> a[i][j];
  for (i = 0; i <= 3; i++) {
    if (a[i][3] == 1) {
      if (a[(i + 1) % 4][0] || a[(i + 2) % 4][1] || a[(i + 3) % 4][2] ||
          a[i][0] || a[i][1] || a[i][2]) {
        cout << "YES";
        exit(0);
      }
    }
  }
  cout << "NO";
}
