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