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