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