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