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