#include <bits/stdc++.h>
using namespace std;
int main() {
  int l1, l2, l3, l4, s1, s2, s3, s4, r1, r2, r3, r4, p1, p2, p3, p4;
  cin >> l1 >> s1 >> r1 >> p1;
  cin >> l2 >> s2 >> r2 >> p2;
  cin >> l3 >> s3 >> r3 >> p3;
  cin >> l4 >> s4 >> r4 >> p4;
  p1 &= (l1 | s1 | r1 | l2 | s3 | r4);
  p2 &= (l2 | s2 | r2 | l3 | s4 | r1);
  p3 &= (l3 | s3 | r3 | l4 | s1 | r2);
  p4 &= (l4 | s4 | r4 | l1 | s2 | r3);
  if (p1 || p2 || p3 || p4)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
