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