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