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