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