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