#include <bits/stdc++.h>
using namespace std;
int a[4][4];
int main() {
  bool ans = false;
  while (cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[0][3]) {
    for (int i = 1; i <= 3; i++) {
      cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
    }
    if (a[0][0] == 1) {
      if (a[0][3] == 1 || a[3][3] == 1) {
        ans = true;
      }
    }
    if (a[0][1] == 1) {
      if (a[0][3] == 1 || a[2][3] == 1) {
        ans = true;
      }
    }
    if (a[0][2] == 1) {
      if (a[0][3] == 1 || a[1][3] == 1) {
        ans = true;
      }
    }
    if (a[1][0] == 1) {
      if (a[1][3] == 1 || a[0][3] == 1) {
        ans = true;
      }
    }
    if (a[1][1] == 1) {
      if (a[1][3] == 1 || a[3][3] == 1) {
        ans = true;
      }
    }
    if (a[1][2] == 1) {
      if (a[1][3] == 1 || a[2][3] == 1) {
        ans = true;
      }
    }
    if (a[2][0] == 1) {
      if (a[2][3] == 1 || a[1][3] == 1) {
        ans = true;
      }
    }
    if (a[2][1] == 1) {
      if (a[2][3] == 1 || a[0][3] == 1) {
        ans = true;
      }
    }
    if (a[2][2] == 1) {
      if (a[2][3] == 1 || a[3][3] == 1) {
        ans = true;
      }
    }
    if (a[3][0] == 1) {
      if (a[3][3] == 1 || a[2][3] == 1) {
        ans = true;
      }
    }
    if (a[3][1] == 1) {
      if (a[3][3] == 1 || a[1][3] == 1) {
        ans = true;
      }
    }
    if (a[3][2] == 1) {
      if (a[3][3] == 1 || a[0][3] == 1) {
        ans = true;
      }
    }
    if (ans) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
