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