#include <bits/stdc++.h>
using namespace std;
int ar[10][10];
int main() {
  ios::sync_with_stdio(false);
  int i, j, x = 0, y, n, m;
  for (int i = 1; i <= 4; i++)
    for (int j = 1; j <= 4; j++) cin >> ar[i][j];
  if (ar[1][1] == 1) {
    if (ar[1][4] == 1 || ar[4][4] == 1) x = 1;
  }
  if (ar[1][2] == 1) {
    if (ar[1][4] == 1 || ar[3][4] == 1) x = 1;
  }
  if (ar[1][3] == 1) {
    if (ar[1][4] == 1 || ar[2][4] == 1) x = 1;
  }
  if (ar[2][1] == 1) {
    if (ar[2][4] == 1 || ar[1][4] == 1) x = 1;
  }
  if (ar[2][2] == 1) {
    if (ar[2][4] == 1 || ar[4][4] == 1) x = 1;
  }
  if (ar[2][3] == 1) {
    if (ar[2][4] == 1 || ar[3][4] == 1) x = 1;
  }
  if (ar[3][1] == 1) {
    if (ar[3][4] == 1 || ar[2][4] == 1) x = 1;
  }
  if (ar[3][2] == 1) {
    if (ar[3][4] == 1 || ar[1][4] == 1) x = 1;
  }
  if (ar[3][3] == 1) {
    if (ar[3][4] == 1 || ar[4][4] == 1) x = 1;
  }
  if (ar[4][1] == 1) {
    if (ar[4][4] == 1 || ar[3][4] == 1) x = 1;
  }
  if (ar[4][2] == 1) {
    if (ar[4][4] == 1 || ar[2][4] == 1) x = 1;
  }
  if (ar[4][3] == 1) {
    if (ar[4][4] == 1 || ar[1][4] == 1) x = 1;
  }
  if (x == 1)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
