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